{"id":384,"date":"2020-03-04T13:15:00","date_gmt":"2020-03-04T13:15:00","guid":{"rendered":"https:\/\/bootstrap-it.com\/blog\/?p=384"},"modified":"2020-08-04T13:34:37","modified_gmt":"2020-08-04T13:34:37","slug":"how-to-use-amazon-simple-email-service-ses-to-replace-your-server-based-email-server","status":"publish","type":"post","link":"https:\/\/bootstrap-it.com\/blog\/?p=384","title":{"rendered":"How to use Amazon Simple Email Service (SES) to replace your server-based email server"},"content":{"rendered":"<div id=\"s-share-buttons\" class=\"horizontal-w-c-circular s-share-w-c\"><a href=\"http:\/\/www.facebook.com\/sharer.php?u=https:\/\/bootstrap-it.com\/blog\/?p=384\" target=\"_blank\" title=\"Share to Facebook\" class=\"s3-facebook hint--top\"><\/a><a href=\"http:\/\/twitter.com\/intent\/tweet?text=How to use Amazon Simple Email Service (SES) to replace your server-based email server&url=https:\/\/bootstrap-it.com\/blog\/?p=384\" target=\"_blank\"  title=\"Share to Twitter\" class=\"s3-twitter hint--top\"><\/a><a href=\"http:\/\/reddit.com\/submit?url=https:\/\/bootstrap-it.com\/blog\/?p=384&title=How to use Amazon Simple Email Service (SES) to replace your server-based email server\" target=\"_blank\" title=\"Share to Reddit\" class=\"s3-reddit hint--top\"><\/a><a href=\"http:\/\/www.linkedin.com\/shareArticle?mini=true&url=https:\/\/bootstrap-it.com\/blog\/?p=384\" target=\"_blank\" title=\"Share to LinkedIn\" class=\"s3-linkedin hint--top\"><\/a><a href=\"mailto:?Subject=How%20to%20use%20Amazon%20Simple%20Email%20Service%20(SES)%20to%20replace%20your%20server-based%20email%20server&Body=Here%20is%20the%20link%20to%20the%20article:%20https:\/\/bootstrap-it.com\/blog\/?p=384\" title=\"Email this article\" class=\"s3-email hint--top\"><\/a><\/div>\n<p>One fine day, for no discernible reason, my Ubuntu 18.04&nbsp;<a href=\"https:\/\/bootstrap-it.com\/\">business server<\/a>&nbsp;stopped forwarding mail to my Gmail address.<\/p>\n\n\n\n<p>Just the day before, the .forward files I&#8217;d created in the home directories of the local server accounts I use for email &#8211; like \/home\/office\/.forward &#8211; were cheerfully redirecting all the mail aimed at my business addresses to my daily-use Gmail account. And then they suddenly stopped.<\/p>\n\n\n\n<p>When I noticed something was wrong, I immediately consulted my server logs. \/var\/log\/mail.err was spitting out charming messages that included things like:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>status=deferred (delivery temporarily suspended: connect to alt2.gmail-smtp-in.l.google.com[219.8.202.27]:25: Connection timed out)<\/code><\/pre>\n\n\n\n<p>Checking the server mailboxes told me that mail was coming in, but that Postfix couldn&#8217;t establish a connection to Gmail to forward messages to my address.<\/p>\n\n\n\n<p>Naturally I restarted Postfix, but that didn&#8217;t help.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl restart postfix<\/code><\/pre>\n\n\n\n<p>I confirmed that there was nothing blocking outgoing messages from leaving my server on port 25 (SMTP). Then I checked to make sure my domain hadn&#8217;t somehow been blacklisted (there are&nbsp;<a href=\"https:\/\/mxtoolbox.com\/domain\">numerous<\/a>&nbsp;online&nbsp;<a href=\"https:\/\/www.ultratools.com\/tools\/emailTest\">tools<\/a>&nbsp;that&#8217;ll do that for you), and peeked at the state of my MX records by running dig from the command line:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>dig MX bootstrap-it.com<\/code><\/pre>\n\n\n\n<p>Nothing doing. Everything seemed to check out.<\/p>\n\n\n\n<p>After a few frustrating troubleshooting sessions I gave up and figured I&#8217;d try something completely different.<\/p>\n\n\n\n<p>Being an AWS solutions architect and having co-authored two books for Wiley\/Sybex on AWS (one a&nbsp;<a href=\"https:\/\/www.amazon.com\/gp\/product\/1119490707\/ref=as_li_tl?ie=UTF8&amp;camp=1789&amp;creative=9325&amp;creativeASIN=1119490707&amp;linkCode=as2&amp;tag=projemun-20&amp;linkId=c407a50c1752a2bc7d9ff3ea66ac8cdc\">guide to the Cloud Practitioners exam<\/a>&nbsp;and one for the<a href=\"https:\/\/www.amazon.com\/Certified-Solutions-Architect-Study-Guide\/dp\/111950421X\/ref=as_sl_pc_tf_til?tag=projemun-20&amp;linkCode=w00&amp;linkId=7c57304cbc082e8d089c86fda94aad7c&amp;creativeASIN=111950421X\">&nbsp;Solutions Architect Associate exam<\/a>), shouldn&#8217;t I be willing and able to build my own stack of AWS tools that&#8217;ll handle my email server needs in the cloud?<\/p>\n\n\n\n<p>Well it turns out that I was both willing and &#8211; after some serious research and trial and error &#8211; able. Getting it done would require:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Creating an S3 bucket where incoming emails will be stored.<\/li><li>Creating a Simple Notification Service (SNS) topic to email me a notice every time a new email arrives.<\/li><li>Configuring Amazon&#8217;s Simple Email Service (SES) to take over my email domain (bootstrap-it.com) and handle incoming mail. That involves adding an MX record to Route 53 (where my domains are managed) and pointing SES to my domain; adding and verifying each email address I want SES to control; and then telling SES to send new messages to my S3 bucket while also triggering an alert for the SNS topic.<\/li><li>Assuming you will also want to&nbsp;<em>send<\/em>&nbsp;email messages through the service, it&#8217;s also a good idea to configure SES to sign your outgoing messages using DomainKeys Identified Mail (DKIM).<\/li><\/ul>\n\n\n\n<p>I&#8217;m not going to describe all those steps in detail here. There&#8217;s plenty of&nbsp;<a href=\"https:\/\/docs.aws.amazon.com\/ses\/latest\/DeveloperGuide\/receiving-email.html\">excellent documentation<\/a>&nbsp;available for that. But I will briefly mention some pain points you might encounter.<\/p>\n\n\n\n<p>You&#8217;ll have to add an MX record to your DNS hosted zone for each domain you&#8217;re using. Even if your domains are managed within Amazon&#8217;s Route 53, you&#8217;ll need to provide a value for your record.<\/p>\n\n\n\n<p>What you use for that value will depend on the AWS region where your SES resource is located. In my case, it looked like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>10 inbound-smtp.us-east-1.amazonaws.com<\/code><\/pre>\n\n\n\n<p>The SNS notifications will arrive in a single long string of text containing just a couple of short morsels of useful but hard-to-read information. That&#8217;ll be enough to identify spam, but you&#8217;ll usually need more information than what you&#8217;ll find here. I use the notifications as a heads-up telling me that there&#8217;s new mail in my S3 bucket.<\/p>\n\n\n\n<p>Viewing the emails themselves within your S3 bucket via the AWS Management Console isn&#8217;t the end of the world if it only happens once or twice a month. But if they&#8217;re coming in faster than that, you&#8217;ll need to find a better way to access and read your messages.<\/p>\n\n\n\n<p>However, creating a protocol for automating that process is really a local operating system problem that requires an entirely different set of tools. I solved the problem for myself using the AWS CLI and a cool Bash script. If you&#8217;d like to see how I did that,&nbsp;<a href=\"https:\/\/www.freecodecamp.org\/news\/bash-script-download-view-from-s3-bucket\/\">click through to this article<\/a>.<\/p>\n\n\n\n<p><em>There&#8217;s much more administration goodness in the form of books, courses, and articles available at my&nbsp;<a href=\"https:\/\/bootstrap-it.com\/\">bootstrap-it.com<\/a>.<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>One fine day, for no discernible reason, my Ubuntu 18.04&nbsp;business server&nbsp;stopped forwarding mail to my Gmail address. Just the day before, the .forward files I&#8217;d created in the home directories of the local server accounts I use for email &#8211;&hellip; <a href=\"https:\/\/bootstrap-it.com\/blog\/?p=384\" class=\"more-link\">Continue Reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":403,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-384","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.2.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to use Amazon Simple Email Service (SES) to replace your server-based email server - Bootstrap IT<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/bootstrap-it.com\/blog\/?p=384\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to use Amazon Simple Email Service (SES) to replace your server-based email server - Bootstrap IT\" \/>\n<meta property=\"og:description\" content=\"One fine day, for no discernible reason, my Ubuntu 18.04&nbsp;business server&nbsp;stopped forwarding mail to my Gmail address. Just the day before, the .forward files I&#8217;d created in the home directories of the local server accounts I use for email &#8211;&hellip; Continue Reading &rarr;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/bootstrap-it.com\/blog\/?p=384\" \/>\n<meta property=\"og:site_name\" content=\"Bootstrap IT\" \/>\n<meta property=\"article:published_time\" content=\"2020-03-04T13:15:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-08-04T13:34:37+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/bootstrap-it.com\/blog\/wp-content\/uploads\/email_square.png\" \/>\n\t<meta property=\"og:image:width\" content=\"480\" \/>\n\t<meta property=\"og:image:height\" content=\"480\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"dbclin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@davidbclinton\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"dbclin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/bootstrap-it.com\/blog\/?p=384\",\"url\":\"https:\/\/bootstrap-it.com\/blog\/?p=384\",\"name\":\"How to use Amazon Simple Email Service (SES) to replace your server-based email server - Bootstrap IT\",\"isPartOf\":{\"@id\":\"https:\/\/bootstrap-it.com\/blog\/#website\"},\"datePublished\":\"2020-03-04T13:15:00+00:00\",\"dateModified\":\"2020-08-04T13:34:37+00:00\",\"author\":{\"@id\":\"https:\/\/bootstrap-it.com\/blog\/#\/schema\/person\/ae0fb1d5b3b01558b92b6426d77766ec\"},\"breadcrumb\":{\"@id\":\"https:\/\/bootstrap-it.com\/blog\/?p=384#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/bootstrap-it.com\/blog\/?p=384\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/bootstrap-it.com\/blog\/?p=384#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/bootstrap-it.com\/blog\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to use Amazon Simple Email Service (SES) to replace your server-based email server\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/bootstrap-it.com\/blog\/#website\",\"url\":\"https:\/\/bootstrap-it.com\/blog\/\",\"name\":\"Bootstrap IT\",\"description\":\"Learn technology using technology\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/bootstrap-it.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/bootstrap-it.com\/blog\/#\/schema\/person\/ae0fb1d5b3b01558b92b6426d77766ec\",\"name\":\"dbclin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/bootstrap-it.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/a93785d437350478a7f1dfcbec58d26bc28e0124e405179acbe1b4325c09f90a?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/a93785d437350478a7f1dfcbec58d26bc28e0124e405179acbe1b4325c09f90a?s=96&d=mm&r=g\",\"caption\":\"dbclin\"},\"sameAs\":[\"http:\/\/bootstrap-it.com\/\",\"dbclinton\",\"https:\/\/twitter.com\/davidbclinton\"],\"url\":\"https:\/\/bootstrap-it.com\/blog\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to use Amazon Simple Email Service (SES) to replace your server-based email server - Bootstrap IT","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/bootstrap-it.com\/blog\/?p=384","og_locale":"en_US","og_type":"article","og_title":"How to use Amazon Simple Email Service (SES) to replace your server-based email server - Bootstrap IT","og_description":"One fine day, for no discernible reason, my Ubuntu 18.04&nbsp;business server&nbsp;stopped forwarding mail to my Gmail address. Just the day before, the .forward files I&#8217;d created in the home directories of the local server accounts I use for email &#8211;&hellip; Continue Reading &rarr;","og_url":"https:\/\/bootstrap-it.com\/blog\/?p=384","og_site_name":"Bootstrap IT","article_published_time":"2020-03-04T13:15:00+00:00","article_modified_time":"2020-08-04T13:34:37+00:00","og_image":[{"width":480,"height":480,"url":"https:\/\/bootstrap-it.com\/blog\/wp-content\/uploads\/email_square.png","type":"image\/png"}],"author":"dbclin","twitter_card":"summary_large_image","twitter_creator":"@davidbclinton","twitter_misc":{"Written by":"dbclin","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/bootstrap-it.com\/blog\/?p=384","url":"https:\/\/bootstrap-it.com\/blog\/?p=384","name":"How to use Amazon Simple Email Service (SES) to replace your server-based email server - Bootstrap IT","isPartOf":{"@id":"https:\/\/bootstrap-it.com\/blog\/#website"},"datePublished":"2020-03-04T13:15:00+00:00","dateModified":"2020-08-04T13:34:37+00:00","author":{"@id":"https:\/\/bootstrap-it.com\/blog\/#\/schema\/person\/ae0fb1d5b3b01558b92b6426d77766ec"},"breadcrumb":{"@id":"https:\/\/bootstrap-it.com\/blog\/?p=384#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/bootstrap-it.com\/blog\/?p=384"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/bootstrap-it.com\/blog\/?p=384#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/bootstrap-it.com\/blog"},{"@type":"ListItem","position":2,"name":"How to use Amazon Simple Email Service (SES) to replace your server-based email server"}]},{"@type":"WebSite","@id":"https:\/\/bootstrap-it.com\/blog\/#website","url":"https:\/\/bootstrap-it.com\/blog\/","name":"Bootstrap IT","description":"Learn technology using technology","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/bootstrap-it.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/bootstrap-it.com\/blog\/#\/schema\/person\/ae0fb1d5b3b01558b92b6426d77766ec","name":"dbclin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/bootstrap-it.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/a93785d437350478a7f1dfcbec58d26bc28e0124e405179acbe1b4325c09f90a?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/a93785d437350478a7f1dfcbec58d26bc28e0124e405179acbe1b4325c09f90a?s=96&d=mm&r=g","caption":"dbclin"},"sameAs":["http:\/\/bootstrap-it.com\/","dbclinton","https:\/\/twitter.com\/davidbclinton"],"url":"https:\/\/bootstrap-it.com\/blog\/?author=1"}]}},"_links":{"self":[{"href":"https:\/\/bootstrap-it.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/384","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bootstrap-it.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bootstrap-it.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bootstrap-it.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bootstrap-it.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=384"}],"version-history":[{"count":2,"href":"https:\/\/bootstrap-it.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/384\/revisions"}],"predecessor-version":[{"id":404,"href":"https:\/\/bootstrap-it.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/384\/revisions\/404"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/bootstrap-it.com\/blog\/index.php?rest_route=\/wp\/v2\/media\/403"}],"wp:attachment":[{"href":"https:\/\/bootstrap-it.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=384"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bootstrap-it.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=384"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bootstrap-it.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=384"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}