{"id":591,"date":"2009-12-02T10:41:56","date_gmt":"2009-12-02T08:41:56","guid":{"rendered":"http:\/\/raftaman.net\/?p=591"},"modified":"2021-05-15T11:46:41","modified_gmt":"2021-05-15T09:46:41","slug":"ssmtp-revaliases-aliases-and-mail-rc","status":"publish","type":"post","link":"https:\/\/possiblelossofprecision.net\/?p=591","title":{"rendered":"sSMTP revaliases, aliases and mail.rc"},"content":{"rendered":"<p>I already <a href=\"https:\/\/possiblelossofprecision.net\/?p=247\">wrote about sending mails with ssmtp<\/a>, a simple alternative to sendmail. But since I got a few questions (and I tend to forget myself) how to use ssmtp&#8217;s <code>revaliases<\/code>-file, here is a short reminder:<\/p>\n<p><code>\/etc\/revaliases<\/code>, allows you to map a local user to a specific <strong>&#8216;From:&#8217; address on outbound mail<\/strong> and to route that mail through a specific mailhub. But it will not rewrite the &#8216;To:&#8217; address according to the local user who should receive the mail.<\/p>\n<p>Usually, you would add aliases to <code>\/etc\/aliases<\/code> to ensure that a local user (receiving a mail) is mapped to a valid eMail address. But as the documentation clearly says (if you actually read it), <strong>ssmtp does not use <code>\/etc\/aliases<\/code><\/strong>.<\/p>\n<p>The solution turns out to be letting <code>mail<\/code> handle the alias \u2013 which is done by configuring aliases in <code>\/etc\/mail.rc<\/code><\/p>\n<pre class=\"brush: plain; highlight: [4]; light: true; title: ; notranslate\" title=\"\">\r\nset ask askcc append dot save crt\r\nignore Received Message-Id Resent-Message-Id Status Mail-From Return-Path Via Delivered-To\r\nalias root root&lt;yourname@domain.com&gt;\r\nalias localuser localuser&lt;yourname@domain.com&gt;\r\n<\/pre>\n<p>You can test it with with:<\/p>\n<pre class=\"brush: plain; highlight: [1]; light: true; title: ; notranslate\" title=\"\">\r\n# echo test | mail -s \"testing ssmtp\" localuser\r\n<\/pre>\n<p>The mail will actually be delivered to yourname@domain.com (since &#8216;localuser&#8217; is mapped to this address in <code>\/etc\/mail.rc<\/code>).<\/p>\n<p>Enjoy!<\/p>\n<p>Resources:<br \/>\n<a href=\"http:\/\/www.linux.com\/archive\/feature\/132006\">http:\/\/www.linux.com\/archive\/feature\/132006<\/a><br \/>\n<a href=\"http:\/\/greybeardedgeek.net\/?p=17\">http:\/\/greybeardedgeek.net\/?p=17<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I already wrote about sending mails with ssmtp, a simple alternative to sendmail. But since I got a few questions (and I tend to forget myself) how to use ssmtp&#8217;s revaliases-file, here is a short reminder: \/etc\/revaliases, allows you to map a local user to a specific &#8216;From:&#8217; address on outbound mail and to route that mail through a specific&#8230; <a href=\"https:\/\/possiblelossofprecision.net\/?p=591\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[13,7],"class_list":["post-591","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-centos","tag-fedora"],"_links":{"self":[{"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/posts\/591","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=591"}],"version-history":[{"count":13,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/posts\/591\/revisions"}],"predecessor-version":[{"id":1827,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/posts\/591\/revisions\/1827"}],"wp:attachment":[{"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=591"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=591"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=591"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}