FoxPro Programming
SMTP send using Office 365
Using the following code I cannot seem to get anything to work using the smtp.office365.com SMTP server. The below code returns a "504 5.7.4 Unrecognized authentication type".
Following is a link to a article explaining the requirements (same article in many posts). https://www.unifeyed.com/portal/knowledgebase/16/How-do-I-use-Office365-for-SMTP.html
do wwSmtp
loSmtp = CREATEOBJECT("wwSmtp")
loSmtp.cMailServer = "smtp.office365.com"
loSmtp.cSenderEmail = "OfficeAdmin@xxx.org"
loSmtp.cSenderName = "companyName - Department"
loSmtp.cUsername = 'OfficeAdmin@xxx.org'
loSmtp.cPassword = 'password'
loSmtp.lUseSsl = .T.
loSmtp.nServerPort=573
loSmtp.cLogfile = 'testmail.log'
loSmtp.cRecipient = 'me@xxx.com'
loSmtp.cSubject = 'smtp Send test'
loSmtp.cContentType = 'text/html'
loSmtp.cMessage = 'This is a test sending from smtp'
loSmtp.cAlternateContentType = "text/plain"
loSmtp.cAlternateText = "Plain text can go here."
IF !loSmtp.SendMail()
wait window loSmtp.cErrorMsg
ELSE
wait wind 'SENT'
ENDIF
Using wwClient 6.0 tools, Windows 10, Foxpro 9 I have tried many variations of the above code without success. Hopefully someone else has gotten this to work.
Make sure nMailMode
is set to 0
. It should be set to .NET Mail Mode.
Defaults have changed at some point and offhand I'm not sure if .NET mode is the default.
+++ Rick ---