Diff: [root] @ c4ad995efa5 | faq | css

smarthosts howto

File created: 33188 howto/multiple-smarthosts [Diff]

diff --git a/howto/multiple-smarthosts b/howto/multiple-smarthosts
new file mode 100644
index 0000000..5e1f718
-- /dev/null
++ b/howto/multiple-smarthosts
@@ -0,0 +1,28 @@
h1. How to send email using two smarthosts, easy and reliable way

Recently I needed to use two email addresses, both for sending and receiving mail. I could use "mutt":http://www.mutt.org for everything, but I prefer separating receiving mail, reading it and sending into three separate programs. So, I tried to configure "exim4":http://www.exim.org, which I have already been using for sending mail via one smarthost, for that, but it's bloated piece of crap, the only sane way of interacting with which is debian configuration, which does not support multiple smarthosts.

So I tried several MTAs until I found "opensmtpd":https://www.opensmtpd.org/. It still uses some kind of homebrew config system but it's quite okay. So here's approximately how do you send mail via appropriate smarthost, based on sender address:

bc.. # /etc/opensmtpd.conf
listen on localhost

table aliases file:/etc/aliases
table sender1 { myfirstaddress@host1 }
table sender2 { mysecondaddress@host2 }
table secrets db:/etc/mail/secrets.db

# local mta functionality
accept for local alias <aliases> deliver to mbox

accept for any sender <sender1> relay via tls+auth://mail1@host:587 auth <secrets>
accept for any sender <sender2> relay via tls+auth://mail2@host2:587 auth <secrets>

p. To fill /etc/mail/secrets.db with your passwords, create /etc/mail/secrets with something like:

bc. mail1 user1:password1
mail2 user2:password2

and run @mkmap /etc/mail/secrets@.

"myfirstaddress@host1" and "mysecondaddress@host2" are your emails, "tls+auth://mailX@hostX:587" are your SMTP connection details (see @man smtpd.conf@ for details), userX:passwordX are your SMTP credentials.

By Voker57 on 2015-10-08 16:39:20 +0300 Powered by bitcheese wiki engine