{"id":78,"date":"2008-07-26T17:23:55","date_gmt":"2008-07-26T16:23:55","guid":{"rendered":"http:\/\/pgregg.com\/wp\/2008\/07\/script-to-generate-a-list-of-valid-email-recipients-from-a-qmail-setup\/"},"modified":"2018-06-12T00:25:13","modified_gmt":"2018-06-11T23:25:13","slug":"script-to-generate-a-list-of-valid-email-recipients-from-a-qmail-setup","status":"publish","type":"post","link":"https:\/\/blog.pgregg.com\/blog\/2008\/07\/script-to-generate-a-list-of-valid-email-recipients-from-a-qmail-setup\/","title":{"rendered":"Script to generate a list of valid email recipients from a qmail setup"},"content":{"rendered":"<p>Last week I set-up a Postfix+MailScanner+ClamAV anti-spam and anti-virus mail relay server. Testing seemed all good, except that it was scanning lots of bogus email addresses, e.g. to nosuchuser@pgregg.com<\/p>\n<p>Postfix provides a relay_recipients file (at least thats what the MailScanner setup called it) where you specify the specific email addresses that you are prepared to accept email for.<\/p>\n<p>In the old days we used SMTP VRFY &#8211; which people dropped because it was a way to verify good email addresses and clean spam lists.\u00a0 \u00a0However, by dropping it it seems the spammers just ignored cleaning and just blast out to any and all email address they could find.\u00a0 The irony being that the problems are now worse because we are constantly being bombarded by spam to bogus addresses.<\/p>\n<p>As my primary email system is (still) qmail I needed a way to build a list of valid emails that qmail would accept &#8211; so I set about writing a perl script that would process the control\/virtualdomains users\/assign and dot-qmail files in the same way that qmail would.<\/p>\n<p>The result is here:<br \/>\n<a href=\"https:\/\/www.pgregg.com\/projects\/qmail\/makevalidrecipients\/MakeValidRecipientsList.pl.txt\" target=\"_blank\" rel=\"nofollow noopener\">https:\/\/www.pgregg.com\/projects\/qmail\/makevalidrecipients\/MakeValidRecipientsList.pl<\/a><\/p>\n<p>Feel free to make use of the script &#8211; hopefully it can help others too.\u00a0 \u00a0Note that it doesn&#8217;t handle ~alias users, nor if you have a database backed system &#8211; but manual and vpopmail setups should be just fine.\u00a0 No warranty implied or given though <img loading=\"lazy\" decoding=\"async\" src=\"img\/smilies\/smile.png\" alt=\":)\" width=\"15\" height=\"15\" \/> Use at your own risk.<\/p>\n<p>Once I added the relay_recipients file to the postfix relay and waited a few days, awstats reported that 99.8% of all my email was to bogus addresses &#8211; wow!\u00a0 That is a massive saving on CPU (antispam\/av scanning) and traffic.<\/p>\n<p>Enjoy.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Last week I set-up a Postfix+MailScanner+ClamAV anti-spam and anti-virus mail relay server. Testing seemed all good, except that it was scanning lots of bogus email addresses, e.g. to nosuchuser@pgregg.com Postfix provides a relay_recipients file (at least thats what the MailScanner setup called it) where you specify the specific email addresses that you are prepared to &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blog.pgregg.com\/blog\/2008\/07\/script-to-generate-a-list-of-valid-email-recipients-from-a-qmail-setup\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Script to generate a list of valid email recipients from a qmail setup&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[12],"tags":[],"class_list":["post-78","post","type-post","status-publish","format-standard","hentry","category-systems"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pbQOUu-1g","jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/blog.pgregg.com\/blog\/wp-json\/wp\/v2\/posts\/78","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.pgregg.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.pgregg.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.pgregg.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.pgregg.com\/blog\/wp-json\/wp\/v2\/comments?post=78"}],"version-history":[{"count":2,"href":"https:\/\/blog.pgregg.com\/blog\/wp-json\/wp\/v2\/posts\/78\/revisions"}],"predecessor-version":[{"id":759,"href":"https:\/\/blog.pgregg.com\/blog\/wp-json\/wp\/v2\/posts\/78\/revisions\/759"}],"wp:attachment":[{"href":"https:\/\/blog.pgregg.com\/blog\/wp-json\/wp\/v2\/media?parent=78"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.pgregg.com\/blog\/wp-json\/wp\/v2\/categories?post=78"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.pgregg.com\/blog\/wp-json\/wp\/v2\/tags?post=78"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}