Sub Process_Globals
Private fx As JFX
Private smtp As SMTP
Private smtpServer As String = "smtp.office365.com"
Private smtpPort As Int = 587
Private smtpUser As String = "[email protected]"
Private smtpPassword As String = "xxxxxxxxxxxxxx"
Private Recipient As String = "[email protected]"
End Sub
Public Sub Send(ToAddress As String, Subject As String, Body As String) As ResumableSub
smtp.Initialize(smtpServer, smtpPort, smtpUser, smtpPassword, "SMTP")
Log("Initialized")
smtp.StartTLSMode = True
smtp.UseSSL = False
smtp.AuthMethod = smtp.AUTH_LOGIN
Log("Connection methods set")
smtp.Sender = smtpUser
smtp.To.Add(Recipient)
smtp.Subject = Subject
smtp.HtmlBody = True
smtp.Body = Body
Log("Email Body set")
'Dim trustall As CustomTrustManager
'trustall.InitializeAcceptAll
'smtp.SetCustomSSLTrustManager(trustall)
'smtp.AdditionalHeaders.Put("Content-Type", "text/html; charset=utf-8")
Wait For (smtp.Send) SMTP_MessageSent (Success As Boolean)
If Success Then
Log("Email sent: " & ToAddress)
Else
Log("Email FAILED:")
Log(LastException)
End If
Return Success
End Sub