ClassMethod SendMAil(mail As %Library.String, Url As %Library.String) As %Status {
Set server=##class(%Net.SMTP).%New()
Set server.smtpserver="smtp.office365.com" //HotPOP SMTP server uses the default port (25) Set server.port=25
//Create object to carry authentication
Set auth=##class(%Net.Authenticator).%New() Set auth.UserName="noreply-service@*********.com" Set auth.Password="************"
Set server.authenticator=auth Set server.AuthFrom=auth.UserName
//create smtp server instance
//generate mail body Set msg = ##class(%Net.MailMessage).%New() Set msg.From=server.authenticator.UserName Do msg.To.Insert(mail) Set msg.Subject="Set New Password"_$H Set msg.IsBinary=0 Set msg.IsHTML=0 Do msg.TextData.Write(Url) set status= server.Send(msg) If $$$ISERR(status) { Do $System.Status.DisplayError(status) Write server.Error
thank's for your back, i'm blocked on the authentification request , i want to extract user name , mail and password from the http request , after i send these parameters to my function in rest class.
go to post
Hi Robert thank you for the answer , but i've already the same problem:
i used an existing SSL configuration on my portal, when i used the port 25 or 587 : i've "connection failed to amtp server" as postman error message
and when i used port 465 : i've "impossible to establish TCP/IP connection " as postman error message
go to post
ClassMethod SendMAil(mail As %Library.String, Url As %Library.String) As %Status
{
Set server=##class(%Net.SMTP).%New()
Set server.smtpserver="smtp.office365.com"
//HotPOP SMTP server uses the default port (25)
Set server.port=25
//Create object to carry authentication
Set auth=##class(%Net.Authenticator).%New()
Set auth.UserName="noreply-service@*********.com"
Set auth.Password="************"
Set server.authenticator=auth
Set server.AuthFrom=auth.UserName
//create smtp server instance
//generate mail body
Set msg = ##class(%Net.MailMessage).%New()
Set msg.From=server.authenticator.UserName
Do msg.To.Insert(mail)
Set msg.Subject="Set New Password"_$H
Set msg.IsBinary=0
Set msg.IsHTML=0
Do msg.TextData.Write(Url)
set status= server.Send(msg)
If $$$ISERR(status) {
Do $System.Status.DisplayError(status)
Write server.Error
Quit ""
}
Quit server.FailedSend
}
**********************************************************************
on my poste man i've this error: ERROR #6034 connetion failed to the SMTP server
go to post
thank you steve , it is what i need
go to post
perfect thank you man
go to post
Hi Amir , the %Ensemble/%Production/StartStop is enable
go to post
Hi Robert , thank you for the answer , please , do you have any example to show for me ?
go to post
Thank you so much orion for help ;)
go to post
Hi Manoj
did you manage to make this configuration work?
if ok, can you tell me how did you do?
thank's
go to post
thank you very much Chris
go to post
Hi Chris
thank's for your back, i'm blocked on the authentification request , i want to extract user name , mail and password from the http request , after i send these parameters to my function in rest class.
thank's