Mail Settings
By default FreeNATS sends mail using the inbuilt mail() function. This allows it to seamlessly use your existing PHP mail configuration. In the case of the virtual appliance this passes the email message to sendmail which then delivers it directly.
Direct delivery means that sendmail attempts to lookup the responsible mail servers for the email address specified (i.e. the MX records for the domain) and directly connect to one of these servers on port 25 to attempt delivery.
This may not work because:
- Your ISP may block outgoing port 25 connections and require you to relay through their mail server
- Your LAN security doesn't allow open outgoing access on port 25
- You wish to deliver to an "internal only" address that FreeNATS is unable to DNS lookup correctly
Prior to version 1 you would only have had the option to patch (or edit) the sendmail.cf file manually for the virtual appliance (or edit your site-wide PHP mail settings for a source install). Version 1 incorporates the excellent phpMailer from codeworxtech.com which allows you to do delivery via a specified SMTP relay and optionally use SMTP AUTH.
To configure mail delivery you will need to set (i.e. create) one of more of the following system variables
Contents
Mail System Variables
mail.smtpserver
Can be a single SMTP server or a semi-colon seperated list (which will be tried in turn) to deliver the mail to. If this variable is anything other than blank phpMailer will be used rather than mail().
Note you can specify ports on a per-server basis by using the format server:port.
mail.smtpusername
If set then SMTP AUTH is used with this username
mail.smtppassword
Password for SMTP AUTH (if mail.smtpusername is set)
mail.smtphostname
The hostname provided to remote SMTP servers if direct to SMTP relay delivery is used (in the HELO line). May need to be set to something resolveable for ultra-strict mail servers.
mail.fromname
For SMTP connections the "proper name" portion of the from (the from email being specified in the specific action/event). Defaults to "FreeNATS" if not set.
mail.smtpsecure
Allows the use of secure connections to the SMTP server (for example as used by gMail). If blank no secure session will be used, other options are "ssl" and "tls" (without quotes).
mail.smtpautotls
If you are *not* using SSL or TLS (i.e. mail.smtpsecure is empty) then by default phpMailer will attempt auto-TLS negotiation if the remote server says they support it (default behaviour). Setting mail.smtpautotls to 0 will disable this (any other value or unset will use the default and will attempt auto TLS if available).
Example gMail Setup
If you wish to send mail through your gMail account you can configure the system to do this with the mail variables.
Your account settings are as follows: Email: someone@gmail.com Password: mypassword Full Name: Someone Somewhere
To send through this account you would need the following system variables set:
- mail.smtphostname = smtp.gmail.com:587
- mail.smtpusername = someone@gmail.com
- mail.smtppassword = mypassword
- mail.smtpsecure = tls
- mail.fromname = Someone Somewhere
You should also take care to set the correct from address (someone@gmail.com) in your alert action when created (or use another email address that you have enabled sending from via your gMail account and verified).