KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Sending e-mail with 4D Internet Commands plug-in
PRODUCT: 4D Internet Commands | VERSION: 6.5 | PLATFORM: Mac & Win
Published On: October 19, 2001
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
Log In

If you want to send e-mails with 4D IC, you can use the quick method or a more complex method. The quick method is based on the SMPT_QuickSend command. This command is very basic and can send a simple e-mail in plain text.

If you want to send your e-mail in HTML format, you need to use the other 4D IC commands such as SMTP_New. In this case, you may define more options than the first method allows. In our case, if we want to send some HTML code in the e-mail, we need to use the SMTP_AddHeader command to specify that the page will be in HTML, and that the body of the message will contain the HTML page itself.

For example:

$Body:="Hello world!
***"
$error:=SMTP_New($smtp_id)
$error:=SMTP_Host ($smtp_id;"MyMailServer")
$error:=SMTP_From ($smtp_id;"From@emailaddress.com")
$error:=SMTP_To ($smtp_id;"Toyou@emailaddress.com")
$error:=SMTP_Subject ($smtp_id;"Subject here!")
$error:=SMTP_Body ($smtp_id;$Body)
$error:=SMTP_AddHeader($SMTP_ID;"Content-Type:";"text/html;charset=us-ascii";1)
$error:=SMTP_Send ($smtp_id)
$error:=SMTP_Clear ($smtp_id)