ph_sendsmtpemailfile1 PowerHome formula function
Description
Sends email (and optionally files) using SMTP via a C# SmtpClient control 
Syntax
ph_sendsmtpemailfile1 ( as_server, al_port, as_user, as_password, ai_usessl, as_from, as_to, as_subject, as_message, as_attachments )
Argument Description
as_server String. The IP or URL of the SMTP server to use
al_port Long. The port for the SMTP server. Typically this is 25
as_user String. The username to send SMTP email as for the server
as_password String. The password for the above username. Supply an empty string "" if username/password is not required
ai_usessl Integer. A flag to specify whether to use SSL/TLS or not. Use 0 to NOT enable SSL/TLS. Any other value to enable it
as_from String. The "from" email address
as_to String. The "to" email address
as_subject String. The subject for the email
as_message String. The email message body
as_attachments String. The full path and filename of files to attach to the email. Separate multiple files with a vertical bar "|" character. Set this parameter to an empty string "" if there are no file attachments
Return value
Integer. Returns 0 if successful. Returns 1 if an exception occurs 
Usage
Use this function as an alternative to the ph_sendsmtpemail( ) and ph_sendsmtpemailfile( ) functions (both of which use a Catalyst SMTP control). Depending upon the particular SMTP server one function over the other may perform better 
Examples
The following examples demonstrate typical syntax/usage for this function.
• ph_sendsmtpemailfile1("smtp.gmail.com",465,"dhoward@gmail.com","yourpassword",1,"dhoward@gmail.com","support@power-home.com","Problem with controller","An error occurred at 2020-05-17 18:10 with the Insteon controller","c:\powerhome\screenshot1.jpg|c:\powerhome\screenshot2.jpg") - Returns 1 if successful. NOTE: Google has recently updated their service and by default no longer allows what they deem "less secure apps" to send SMTP unless youturn on "allow less secure apps" in your GMail settings. Even though this example uses SSL and follows GMail guidelines, "allow less secure apps" must be enabled in order for the example to work
• ph_sendsmtpemailfile1()