FoxPro Programming
SMTP send using Office 365
Gravatar is a globally recognized avatar based on your email address. SMTP send using Office 365
  MarkB
  All
  Feb 22, 2021 @ 03:58pm

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.

Gravatar is a globally recognized avatar based on your email address. re: SMTP send using Office 365
  Rick Strahl
  MarkB
  Feb 22, 2021 @ 05:10pm

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 ---

© 1996-2021