Topic Options
#56049 - 06/19/18 11:55 AM Options to send emails via SMTP to Office 365
Uomo Del Ghiaccio Offline
OL Expert

Registered: 02/21/01
Posts: 666
I'm looking for options to send emails via SMTP to Office 365.
_________________________
Uomo Del Ghiaccio
--------------------

Top
#56062 - 06/20/18 01:49 PM Re: Options to send emails via SMTP to Office 365 [Re: Uomo Del Ghiaccio]
Philippe F. Online   content
OL Expert

Registered: 09/06/00
Posts: 1929
Loc: Objectif Lune, Montreal, Qc
You'll have to script it.
Something like this should get you started (it works fine with our own Office365 server, your mileage may vary...):
Code:
Option explicit
Dim MyMsg
Set MyMsg = CreateObject("CDO.Message" )

SMTPConfig MyMsg, "smtp.office365.com", 25, "youraddress@example.com", "yourpassword", True


MyMsg.From     = "youraddress@example.com"
MyMsg.To       = "recipientaddress@example.com"
MyMsg.Subject  = "This is the subject of the email"
MyMsg.TextBody = "This is the body of the email."

'' When running this Script inside PP-Workflow and the job file
'' has to be attached to the email, uncomment next line

'' MyMsg.AddAttachment Watch.GetJobFileName

MyMsg.Send


Sub SMTPConfig(msg, srv, port, user, pw,useSSL)
  Const cdoFieldPrefix = "http://schemas.microsoft.com/cdo/configuration/"
  with msg
    .Configuration.Fields.Item (cdoFieldPrefix & "sendusing" )        = 2
    .Configuration.Fields.Item (cdoFieldPrefix & "smtpserver" )       = srv
    .Configuration.Fields.Item (cdoFieldPrefix & "smtpserverport" )   = port
    .Configuration.Fields.Item (cdoFieldPrefix & "sendusername" )     = user
    .Configuration.Fields.Item (cdoFieldPrefix & "sendpassword" )     = pw
    .Configuration.Fields.Item (cdoFieldPrefix & "smtpauthenticate")  = 1
    .Configuration.Fields.Item (cdoFieldPrefix & "smtpusessl")        = useSSL
    .Configuration.Fields.Update
  end with
end sub


Edited by Philippe F. (06/20/18 01:49 PM)
Edit Reason: typos
_________________________
Technical Product Manager
I don't want to achieve immortality through my work; I want to achieve immortality through not dying - Woody Allen

Top