{"id":3007,"date":"2020-12-20T13:52:24","date_gmt":"2020-12-20T21:52:24","guid":{"rendered":"https:\/\/www.wellgolly.com\/?p=3007"},"modified":"2020-12-20T13:52:24","modified_gmt":"2020-12-20T21:52:24","slug":"processing-bad-email-addresses-in-our-customer-list","status":"publish","type":"post","link":"https:\/\/www.wellgolly.com\/?p=3007","title":{"rendered":"Processing bad email addresses in our customer list."},"content":{"rendered":"<p>Back in 2014 I wrote a <a href='https:\/\/www.wellgolly.com\/?p=1969'>post<\/a> about processing returned email and enough has changed that the advice is no longer relevant.<\/p>\n<p>I use Apple\u2019s email client to send and receive mail and this time around I created rules for dealing with the remove requests, auto replies, and bad addresses. I don\u2019t get many remove requests so I handle them individually. Likewise, the automated replies usually are out of office or moved to a new location so they get manual treatment as well.<\/p>\n<p>This time around I got 12,002 failures\u2014although the actual number is much lower because servers will give 24, 48, and 72 hour notices as well when they can\u2019t deliver the mail. Deleting the 7,747 warning messages yields 4,255. I used three rules to put the returned mail into a Failure mailbox. <\/p>\n<p>Subject begins with Warning: message<br \/>\nSubject begins with Undeliverable<br \/>\nSubject begins with Mail delivery failed:<\/p>\n<p>This caught most of them. I then selected all of the messages and printed them to a PDF file. <strong>Mail does not warn you that it will only print 300 pages<\/strong> so if you don\u2019t have a lot of failures you can select groups of messages and make sure that there are fewer than 300 pages in the group. My computer is old so it also is slow to delete messages. So you need to be patient.<\/p>\n<p>If you can get the messages into a PDF file you can open it in Preview, select all and then use the BBEdit feature <em>Process Lines Containing<\/em> to first extract lines with @ and then remove ones with your domain. From there it was just a matter of getting rid of things like  <em>retry timeout exceeded<\/em>, <em>Final-Recipient: rfc822;<\/em>,  and <em>Status: 5.0.0<\/em> by doing a simple find and replace.<\/p>\n<p>Getting rid of the last group took a bit of grepping since I wanted to get rid of everything before the \u201c<\u201d e.g.\n<pre><code class=\"preserve-code-formatting\">\nTo: &quot;Alice Foxwood&quot; &lt;AliceFoxwood@yahoo.com&gt;\n<\/code><\/pre>\nbut it\u2019s just \n<pre><code class=\"preserve-code-formatting\">\n*.&lt;\n<\/code><\/pre>\nIf you have lots of failures, and I normally get a bunch of I haven\u2019t sent out an email in a while, then you need a different method. First you need to find where Mail put the Failure folder. MacOS won\u2019t let you into the Mail directory so you need to copy it to your Desktop and then use the terminal to find one of the failed messages.\n<pre><code class=\"preserve-code-formatting\">\ncd \/Users\/jscarry\/Desktop\/Mail\ngrep -R &#039;AliceFoxwood@yahoo.com&#039; .\n<\/code><\/pre>\n\nIn my case the message was in\n<pre><code class=\"preserve-code-formatting\">\ncd .\/V7\/06676897-0872-4618-9225-222A5281A236\/Failure.mbox\/69AC0518-E9C8-4B54-ADD0-2A0B676267B4\/Data\/\n<\/code><\/pre>\n\nThen I copied every line with an @ to a file:\n<pre><code class=\"preserve-code-formatting\">\ngrep -R &quot;@&quot; . &gt; ~\/Desktop\/failure.txt\n<\/code><\/pre>\n\nThis method gives you all of the header info so you get lots more junk than in the first method. I spent maybe 20 minutes using BBEdit to get rid of things before and after the address. Multiple sorts and deleting duplicates helped. I also used the <em>Process Lines Containing<\/em> feature to find all the lines with @ and copy them to a new file since some of my edits resulted in lines without an email address.<\/p>\n<p>There are lots of duplicates in the list since so I sorted the lines and then removed duplicates. That left me with 4255 bad addresses which I then imported to my bad address table. That\u2019s more than the 4,116 failure emails because some of the failure messages had an internal email address e.g. AliceFoxwood@baylor0.mail.onmicrosoft.com.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Back in 2014 I wrote a post about processing returned email and enough has changed that the advice is no longer relevant. I use Apple\u2019s email client to send and receive mail and this time around I created rules for dealing with the remove requests, auto replies, and bad addresses. I don\u2019t get many remove &hellip; <a href=\"https:\/\/www.wellgolly.com\/?p=3007\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Processing bad email addresses in our customer list.<\/span><\/a><\/p>\n","protected":false},"author":6,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-3007","post","type-post","status-publish","format-standard","hentry","category-coding"],"_links":{"self":[{"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=\/wp\/v2\/posts\/3007","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3007"}],"version-history":[{"count":8,"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=\/wp\/v2\/posts\/3007\/revisions"}],"predecessor-version":[{"id":3015,"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=\/wp\/v2\/posts\/3007\/revisions\/3015"}],"wp:attachment":[{"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3007"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3007"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3007"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}