{"id":7,"date":"2022-11-14T20:39:46","date_gmt":"2022-11-14T20:39:46","guid":{"rendered":"https:\/\/daveking.com\/blog\/?p=7"},"modified":"2022-11-15T13:47:31","modified_gmt":"2022-11-15T18:47:31","slug":"configuring-exim4-as-a-mail-relay-on-ubuntu-linux","status":"publish","type":"post","link":"https:\/\/daveking.com\/blog\/index.php\/2022\/11\/14\/configuring-exim4-as-a-mail-relay-on-ubuntu-linux\/","title":{"rendered":"Configuring exim4 as a Mail Relay on Ubuntu Linux"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">My goal is to have the system&#8217;s MTA (exim4) forward any emails sent on the local host to a remote mail server for distribution. No mail will be received locally on this host, all mail will be forwarded elsewhere.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Ubuntu uses the command <code>dpgk-reconfigure exim4-config<\/code> to generate the exim4 configuration file <code>\/var\/lib\/exim4\/config.autogenerated<\/code>. Two additional files must be created to complete the configuration.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Create <code>\/etc\/exim4\/exim4.conf.localmacros<\/code> containing the line:<br><code>MAIN_LOCAL_DOMAINS =<\/code><br>This will force exim4 to send all mail to the remote mail server and not to try to delivery anything locally.<\/li>\n\n\n\n<li>Edit <code>\/etc\/exim4\/passwd.client<\/code> and add a line containing the SMTP login used to access the remote mail server:<br><code>*:userid:password<\/code><br>Beware that special characters in the userid or password can cause problems.<\/li>\n\n\n\n<li>Run <code>dpgk-reconfigure exim4-config<\/code>\n<ul class=\"wp-block-list\">\n<li><strong>General type of mail configuration:<\/strong> mail sent by smarthost; no local mail<\/li>\n\n\n\n<li><strong>System mail name:<\/strong> <em>your_hostname.com<\/em><\/li>\n\n\n\n<li><strong>IP-address to listen on for incoming SMTP connections:<\/strong>127.0.0.1 ; ::1<\/li>\n\n\n\n<li><strong>Other destinations for which mail is accepted:<\/strong> <em>leave this blank<\/em><\/li>\n\n\n\n<li><strong>Visible domain name for local users:<\/strong> <em>your_hostname.com<\/em><\/li>\n\n\n\n<li><strong>IP address or host name of the outgoing smarthost:<\/strong> <em>mail.server.com<\/em>::587<\/li>\n\n\n\n<li><strong>Keep number of DNS-queries minimal (Dial-on-Demand)?<\/strong> No<\/li>\n\n\n\n<li><strong>Split configuration file into small files?<\/strong> No<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Restart exim4: <code>systemctl restart exim4<\/code><\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>How to configure exim4 on Ubunti to forward all outbound e-mail via a SMTP mail gateway<\/p>\n","protected":false},"author":1,"featured_media":24,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_editorskit_title_hidden":false,"_editorskit_reading_time":0,"_editorskit_is_block_options_detached":false,"_editorskit_block_options_position":"{}","_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[7],"tags":[4,3,6],"class_list":["post-7","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux-administration","tag-exim","tag-linux","tag-sendmail","eq-blocks"],"jetpack_publicize_connections":[],"jetpack-related-posts":[],"jetpack_likes_enabled":true,"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/i0.wp.com\/daveking.com\/blog\/wp-content\/uploads\/2022\/11\/exim-logo.jpg?fit=400%2C300&ssl=1","_links":{"self":[{"href":"https:\/\/daveking.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/7","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/daveking.com\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/daveking.com\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/daveking.com\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/daveking.com\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=7"}],"version-history":[{"count":3,"href":"https:\/\/daveking.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/7\/revisions"}],"predecessor-version":[{"id":102,"href":"https:\/\/daveking.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/7\/revisions\/102"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/daveking.com\/blog\/index.php\/wp-json\/wp\/v2\/media\/24"}],"wp:attachment":[{"href":"https:\/\/daveking.com\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=7"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/daveking.com\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=7"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/daveking.com\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=7"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}