Outbound email
Mandrill will be used for outbound email from CoL Intranet servers (InsideLaw, et al).
The WP Mandrill plugin replaces the wp_mail() internal function that should allow all well-behaved functions to send mail via Mandrill.
In addition, the server's sSMTP can send via Mandrill to accommodate ill-behaved WP plugins and to service WebMin, cron, and other Linux functions. (the other option is to use the gsulaw.net account, which uses Google's mail services.)
The sSMTP config file (/etc/ssmtp/ssmtp.conf):
# Config file for sSMTP sendmail # # The person who gets all mail for userids < 1000 # Make this empty to disable rewriting. root=postmaster # Where will the mail seem to come from? #rewriteDomain= # The full hostname hostname=lawmaint.gsu.edu # Are users allowed to set their own From: address? # YES - Allow the user to specify their own From: address # NO - Use the system generated From: address FromLineOverride=YES # The place where the mail goes. The actual machine name is required no MX records are consulted. mailhub=smtp.mandrillapp.com:587 # for Mandrill UseTLS=YES UseSTARTTLS=YES AuthMethod=LOGIN AuthUser=terrance@gsu.edu AuthPass={valid API key} such as RE7FnLe8dkLa6zXEGhc6pa
To avoid needing to secure the .conf file, set up the API key in Mandrill to be valid only from the server's IP address.
Sender email address
Note that many email sending systems within WordPress default to the sender email address of "wordpress@domain.com" so that we had invalid from addresses, e.g. "wordpress@lawmaint.gsu.edu"
A small filter added to the theme functions.php sets the sender to the currently logged-in user, using the code below. Note that the reply-to address is still set by Formidable in the "Email Notifications" "From" address.
function col_mail_from() { global $current_user; get_currentuserinfo(); $email = ( $current_user->user_email ) ?: 'insidelaw@gsu.edu'; return $email; } function col_mail_from_name() { global $current_user; get_currentuserinfo(); $display_name = ( $current_user->display_name ) ?: 'InsideLaw'; return $display_name; } add_filter('wp_mail_from','col_mail_from'); add_filter('wp_mail_from_name','col_mail_from_name');
It *might* be better to look up the server admin account info (user_id = 1??) instead of hard-coding the fall-back address (if user not signed in).
Incoming email
There is the possibility to also use Mandrill for inbound email - it will "forward" the email as an HTTP POST in a JSON format
Setttings for inbound mail require adding the domain under the "Inbound" tab in the Mandrill control panel and then making the DNS changes as specified there.