Tips on SMTP email

Info for sending e-mail via SMTP is a bit sparse so I thought I'd post a tip here in case anyone else wants to do this. My email server is accessible via authenticated user, and it's not on the localhost of the web server. I host HTTP with DreamHost but I do not use their email server. The problem I was trying to solve was that emails generated with sendmail, or from unauthenticated users, would be delivered with the From like "myunixuser@myservername.dreamhost.com on behalf of MySiteName [noreply@domain.tld]". That's completely unacceptable. So here is how I changed that in config.php:

$config['mail']['backend'] = 'smtp';
$config['mail']['params'] = array(
'host' => 'smtp.mydomain.com',
'port' => 2525,
'auth' => true,
'username' => 'realuser@mydomain.com',
'password' => 'thepassword'
);
$config['mail']['appname'] = 'mySNappname';
$config['mail']['check_domain'] = true;
$config['mail']['notifyfrom'] = '"MySite Status" <support@mydomain.com>';
$config['mail']['domain'] = 'mydomain.com';

Now emails look very professional, not spammy or system-generated.

I was also pleased to find that emails from the site have unique headers:
X-StatusNet-MessageType: mention
X-StatusNet-TargetUser: myname
X-StatusNet-SourceUser: originatorname
X-StatusNet-Domain: status.mydomain.com

There is also a MessageType "subscribe".

HTH

EDIT: Revised notifyfrom, UI here removed the email address as though it was an invalid tag.

Comments

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Google Sign In with OpenID