Syntax:

SETEMAILSERVER(smtp_server,smtp_user,smtp_password,security_protocol)

    • smtp_server: The address of the SMTP server.
    • smtp_user: The SMTP user name. Usually, it is the same as the sender email address.
    • smtp_password: The SMTP password.
    • security protocol (optional):

      AUTO

      Automatically detect the SSL/TLS version of the server. This is the default value.

      SSL2

      Use SSL version 2

      SSL3

      Use SSL version 3

      TLS

      Use TLS

    Return Value:

    SETEMAILSERVER always returns “OK”

    Remarks:

    If your SMTP server does not require authentication you have to leave the smtp_user and smtp_password parameters as empty text strings. See the examples below.

    See also:

    SENDEMAIL
    SETEMAILSERVERPORT
    Sending emails from a script

    Examples:

    # Set the SMTP server settings
    SETEMAILSERVER("smtp.mydomain.com","me@domain.com","the_password",AUTO)
     
    # Send the email
    SENDEMAIL("me@domain.com","destination@domain.com","","","this is the subject","this is the email body","C:\Users\Carlos\Desktop\scriptftp_log.txt")
    # The SMTP server does not require authentication
    SETEMAILSERVER("smtp.mydomain.com","","",AUTO)
     
    # Send the email
    SENDEMAIL("me@domain.com","destination@domain.com","","","this is the subject","this is the email body","C:\Users\Carlos\Desktop\scriptftp_log.txt")