Not sure if this helps at all but in case it does, this works for us running 4D 
v16 R5. We use it to connect to our Exchange account using the Office 365 
hosting service.

// long working version
C_LONGINT($error;$sslSMTPPort)
C_LONGINT($smtp_id)
C_TEXT($smtpHost)
C_TEXT($replyTo;$sendEmailTo)
C_TEXT($msg;$subject)

$sslSMTPPort:=587  // port used for SSL SMTP - gmail wants 465
$smtpHost:="smtp.office365.com"  
$User:="u...@companyname.com"  
$Pass:="YourPassword"  
$replyTo:="u...@companyname.com"  // have replies sent here

$sendEmailTo:="recipi...@companyname.com"
$BCCsendEmailTo:="recipi...@companyname.com "
$subject:="This is a test at "+String(Current time)
$msg:="Hello world out there."

$error:=IT_SetPort (2;$sslSMTPPort)  //12 is for 'SMTP with SSL'

$error:=SMTP_New ($smtp_id)
$error:=SMTP_Host ($smtp_id;$smtpHost;0)
$error:=SMTP_Auth ($smtp_id;$User;$Pass;0)
SMTP_AddHeader ($smtp_id;"Importance";"Normal";0)
$error:=SMTP_From ($smtp_id;$User;1)
$error:=SMTP_ReplyTo ($smtp_id;$User;0)
$error:=SMTP_To ($smtp_id;$sendEmailTo;0)
$error:=SMTP_Bcc ($smtp_id;$BCCsendEmailTo;0)
$error:=SMTP_Subject ($smtp_id;$subject;0)
$error:=SMTP_Body ($smtp_id;$msg;0)
$error:=SMTP_Send ($smtp_id;0)  //1 to use ssl

Mike McCall

**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**********************************************************************

Reply via email to