ph_sendsmtpemail PowerHome formula function
Description
Sends an email message using SMTP.
Syntax
ph_sendsmtpemail ( Server, Port, fromAddr, toAddr, Subject, text )
Argument Description
Server String. The IP or DSN of the SMTP server.
Port Number. The port of the SMTP server. This is typically port 25.
fromAddr String. The email address you are sending the email from. Most SMTP servers require you to enter a valid email address registered on the SMTP server. You may optionally enter a userid and password if your SMTP server requires authentication.
toAddr String. The email addresses you wish to send a message to. Separate multiple email addresses with commas.
Subject String. The subject of the email.
text String. The text of the email message.
Return value
Integer. Returns 0 if successful. Any other value signifies an error occurred. You can specify multiple recipients by separating the email addresses with commas.
Usage
Use this function to send email using raw SMTP rather than the MAPI interface that the ph_sendemail function uses. If an error occurs while sending using SMTP, the PowerHome system will not hang like it does when sending using MAPI.

If your SMTP server requires authentication, then supply the userid and password in the third parameter after the "From" email address. Separate the "from" email address, userid, and password with commas (do not add spaces).

If your SMTP server uses SSL or TLS, then use a negative port number. In the case of Gmail, the port number is 465 and uses SSL so you would specify a port of -465
Examples
The following examples demonstrate typical syntax/usage for this function.
• ph_sendsmtpemailfile("smtp.mail.yahoo.com",465,"yourmail@yahoo.com,login,password", "someone@gmail.com","Motion Alert","Driveway Motion Detected.")
   {Sends a plain email message}
• ph_sendsmtpemail("smtp.gmail.com", -465,"johndoe@gmail.com,johndoe,121239", "4075551212@cingularme.com","Motion Alert","Motion on DrvCam detected at " + ph_getglobal_s ("LASTRIGDRV")
   {Sends an SMS text mesage to a smartphone.}