Osamu Aoki: exim4 configuration for Desktop (better gmail support)
Since gmail rewrites "From:" address now (2020) and keep changing access limitation, it is wise not to use it as smarthost any more. (If you need to access multiple gmail addresses from mutt etc, use esmtp etc.)
---
For most of our Desktop PC running with stock exim4 and mutt, I think sending out mail is becoming a bit rough since using random smarthost causes lots of trouble due to the measures taken to prevent spams.As mentioned in Exim4 user FAQ , /etc/hosts should have FQDN with external DNS resolvable domain name listed instead of localdomain to get the correct EHLO/HELO line. That's the first step.
The stock configuration of exim4 only allows you to use single smarthost for all your mails. I use one address for my personal use which is checked by my smartphone too. The other account is for subscribing to the mailing list. So I needed to tweak ...
Usually, mutt is smart enough to set the From address since my .muttrc has
# Set default for From: for replyes for alternates.
set reverse_name
So how can I teach exim4 to send mails depending on the mail accounts listed in the From header.
For my debian.org mails, mails should be sent from my shell account on people.debian.org so it is very unlikely to be blocked. Sometimes, I wasn't sure some of these debian.org mails sent through my ISP's smarthost are really getting to the intended person.
To these ends, I have created small patches to the /etc/exim4/conf.d files and reported it to Debian BTS: #869480 Support multiple smarthosts (gmail support). These patches are for the source package.
To use my configuration tweak idea, you have easier route no matter which exim version you are using. Please copy and read pertinent edited files from my github site to your installed /etc/exim4/conf.d files and get the benefits.
- Update router/200_exim4-config_primary by overwriting it with newer router/200_exim4-config_primary
- Add transport/30_exim4-config_remote_smtp_submission and transport/30_exim4-config_remote_smtp_submission
- Update auth/30_exim4-config_examples by overwriting with newer auth/30_exim4-config_examples
- Read passwd.client to set up multiple SMTP message submission host accounts.
- Read README.ssh for how to set up mail to be sent over to the shell account via ssh.
If you really wish to keep envelope address etc. to match From: header, please rewite agressively using the From: header using eddited rewrite/31_exim4-config_rewriting as follows:
.ifndef NO_EAA_REWRITE_REWRITE
*@+local_domains "$ lookup $ local_part lsearch /etc/email-addresses \
$value fail " f
# identical rewriting rule for /etc/mailname
*@ETC_MAILNAME "$ lookup $ local_part lsearch /etc/email-addresses \
$value fail " f
.endif
* "$h_from:" Frs
So far its working fine for me but if you find bug, let me know.
Osamu