ph_sendsmtpemailfile PowerHome formula function
Description
Sends an email message with file attachments using SMTP.
Syntax
ph_sendsmtpemailfile ( s, n, s, s, s, s, s )
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. |
filespec
|
String. The full path and filename of the file to attach to the email. Separate multiple files with the | (vertical bar) character. |
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. Specify multiple files by separating the path/filename with the | (vertical bar) character.
Usage
Use this function to send email with file attachments 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).
Examples
The following examples demonstrate typical syntax/usage for this function.
• ph_sendsmtpemailfile("smtp.mail.yahoo.com",465,"yourname@yahoo.com,login,password", "8885551212@txt.att.net","Motion Alert","Driveway Motion on CAM1 detected.","C:\powerhome\web\CAM1.jpg")