Tech Tip: How to use SMTP_Send and SMTP_QuickSend with SSL
PRODUCT: 4D Internet Commands | VERSION: 12.1 | PLATFORM: Mac & Win
Published On: December 6, 2010
The 4D Internet Commands plugin for 4D v12.1 adds new functionality to the SMTP set of commands; specifically the ability to send using SSL.
For all of the examples below assume there is a interproccess variable named <>UseSMTPssl which is set to either true or false, depending on whether or not ssl should be used.
The ports can be set using the IT_SetPort command like so:
If (<>UseSMTPssl) // use ssl $error:=IT_SetPort (12;465) // 12 sets the ssl smtp port, i used port 465 Else // dont use ssl $error:=IT_SetPort (2;25) // 2 sets the non ssl smtp port, i used port 25 End if |
Using SMTP_Send with SSL is accomplished like so:
If (<>UseSMTPssl) // use ssl $error:=SMTP_Send ($smtp_id;1) //1 to use ssl Else // dont use ssl $error:=SMTP_Send ($smtp_id;0) // 0 to not use ssl End if |
Using SMTP_QuickSend with SSL is accomplished like so:
If (<>UseSMTPssl) // use ssl $Error:=SMTP_QuickSend($Host;$FromAddress;$ToAddress;$Subject;$Message;1) // 1 to use ssl Else // dont use ssl $Error:=SMTP_QuickSend($Host;$FromAddress;$ToAddress;$Subject;$Message;0) // 0 to not use ssl End if |