Ubuntu – How to get FromLineOverride=YES to work in Ubuntu Jaunty 9.04 with google-apps

emailg-suiteUbuntu

I can't get addresses other than my AuthUser address to appear in the "from" address of an e-mail sent from my server, even with the FromLineOverride=YES set in my ssmtp.conf file. Configuration is very straightforward – this should be very easy. Nobody else seems to be having this problem. So, what's going on with my configuration?

The OS is Ubuntu Jaunty 9.04, running on a RackSpace Cloud Server.

I installed ssmtp (sudo apt-get install ssmtp)

I set the config to work with google apps (requisite MS DNS entries per google and changes to ssmtp.conf file).

MX records

  • 1 ASPMX.L.GOOGLE.COM
  • 5 ALT1.ASPMX.L.GOOGLE.COM
  • 5 ALT2.ASPMX.L.GOOGLE.COM
  • 10 ASPMX2.GOOGLEMAIL.COM
  • 10 ASPMX3.GOOGLEMAIL.COM

Conf file: (sudo vi /etc/ssmtp/ssmtp.conf)

root=noreply@mydomain.com
mailhub=smtp.gmail.com:587
hostname=myhost
UseSTARTTLS=yes
UseTLS=yes
AuthUser=me@mydomain.com
AuthPass=P@55w0rd
FromLineOverride=YES

Test in various ways… let's keep it easy and use commandline

cat <<EOF | ssmtp testreceive@domain.com
From: Andy Mytys <testsend@anotherdomain.com>
To: testreceive@domain.com
Subject: Hello World

Hello World
EOF

I get the mail in the testreceive@domain.com account. However, the send is not testsend@anotherdomain.com as one would expect due to the FromLineOverride=YES config line. It is still the authuser account, me@mydomain.com.

What gives????

BTW, if I change the Auth info in the ssmtp.conf file the email fails so I know I'm working with the right conf file.

Best Answer

After much research, I've discovered the following huge drawback: Gmail automatically rewrites the "from" line of any e-mail you send via their SMTP gateway to your Gmail address, and it overrides any Reply-To settings you may have in your e-mail software in favor of the one in Gmail's web interface. Looks like you can point it to another account, but said account can't be dynamic based on the content of an incoming mail header's "from" info - http://mail.google.com/support/bin/answer.py?hl=en&ctx=mail&answer=22370