{"id":9073,"date":"2005-06-14T14:21:51","date_gmt":"2005-06-14T11:21:51","guid":{"rendered":"https:\/\/mamchenkov.net\/wordpress\/?p=9073"},"modified":"2005-06-14T14:22:04","modified_gmt":"2005-06-14T11:22:04","slug":"sending-bulk-html-emails-with-perl","status":"publish","type":"post","link":"https:\/\/mamchenkov.net\/wordpress\/2005\/06\/14\/sending-bulk-html-emails-with-perl\/","title":{"rendered":"Sending bulk HTML emails with perl"},"content":{"rendered":"<!-- google_ad_section_start -->\n<p>First of all, I have to warn you that using HTML in emails is almost always inappropriate.  Use plain text.  If you have to send HTML, than send it as an attachment.<\/p>\n<p>For those cases, where HTML message has to be sent and there is no choice in the matter, here is a small perl script &#8211; <a href='\/wordpress\/wp-content\/send_html_mail.perl' title='send_html_mail.pl'>send_html_mail.pl<\/a><\/p>\n<p>Edit a few lines at the beginning of the file to suit your needs.  From address and Subject line must be changed.  Locactions of two files &#8211; list of recepients and the body of the message &#8211; can be either specified on the command line or will be taken from default values hardcoded in the script.<\/p>\n<p>Run the script as:<\/p>\n<pre>send_html_mail.pl message.html recepients.txt<\/pre>\n<p>If you changed the location of data files or if you are using defaults, than you don&#8217;t have to pass any arguments to the script.<\/p>\n<p>List of recepients is expected to be a comma separated list of names and emails.  An example file could look like this:<\/p>\n<pre>\r\nYou There,you@there.org\r\nHim Somewhere,him@somewhere.net\r\n<\/pre>\n<p>Message body file should contain all your HTML, CSS, JavaScript and whatever else is that you want to send.  Here is an example file for you:<\/p>\n<pre>\r\n&lt;HTML&gt;\r\n&lt;BODY&gt;\r\n&lt;H1&gt;Hi there!&lt;\/H1&gt;\r\n&lt;DIV&gt;This is an HTML message.&lt;\/DIV&gt;\r\n&lt;\/BODY&gt;\r\n&lt;\/HTML&gt;\r\n<\/pre>\n<p>It is easy to change the script to send plain text messages instead of HTML.  Just change the line that specifies Content-Type as &#8220;text\/html&#8221; to &#8220;text\/plain&#8221;.<\/p>\n<!-- google_ad_section_end -->\n","protected":false},"excerpt":{"rendered":"<!-- google_ad_section_start -->\n<p>First of all, I have to warn you that using HTML in emails is almost always inappropriate. Use plain text. If you have to send HTML, than send it as an attachment. For those cases, where HTML message has to be sent and there is no choice in the matter, here is a small perl &hellip; <a href=\"https:\/\/mamchenkov.net\/wordpress\/2005\/06\/14\/sending-bulk-html-emails-with-perl\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Sending bulk HTML emails with perl<\/span><\/a><\/p>\n<!-- google_ad_section_end -->\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":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},"_links_to":"","_links_to_target":""},"categories":[1,18,62],"tags":[36,39],"keyring_services":[],"class_list":["post-9073","post","type-post","status-publish","format-standard","hentry","category-general","category-programming","category-technology","tag-perl","tag-software"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack-related-posts":[{"id":8622,"url":"https:\/\/mamchenkov.net\/wordpress\/2005\/02\/12\/rss2mail\/","url_meta":{"origin":9073,"position":0},"title":"rss2mail","author":"Leonid Mamchenkov","date":"February 12, 2005","format":false,"excerpt":"Previously I have wrote lj2mail - a script which gets fresh posts from LiveJournal and emails them to the list of recepients. I have tried to avoid sending same items over and over again, but failed. The script was implemented with the help of LiveJournal API (LJ::Simple Perl module). I\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":8387,"url":"https:\/\/mamchenkov.net\/wordpress\/2004\/12\/28\/lj2mail\/","url_meta":{"origin":9073,"position":1},"title":"lj2mail","author":"Leonid Mamchenkov","date":"December 28, 2004","format":false,"excerpt":"With this script I will terrorize my friends from today onwards. What it does is get all the recent posts from some LiveJournal blog and email them as separate messages to a list of recepients. Subject of the blog entry is used as a subject of the email. Body of\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":9587,"url":"https:\/\/mamchenkov.net\/wordpress\/2005\/10\/19\/generating-ultimate-movie-wishlist-with-perl-and-imdb\/","url_meta":{"origin":9073,"position":2},"title":"Generating ultimate movie wishlist with Perl and IMDB","author":"Leonid Mamchenkov","date":"October 19, 2005","format":false,"excerpt":"One of the things that will go into history with the year 2005 is the number of bad movies produced by Hollywood. IMDB says: Hollywood is mired in its biggest box-office slump in over 20 years. With all those bad movies around, finding something worth the time and effort becomes\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":8560,"url":"https:\/\/mamchenkov.net\/wordpress\/2005\/01\/30\/linkblogging-with-delicious\/","url_meta":{"origin":9073,"position":3},"title":"Linkblogging with del.icio.us","author":"Leonid Mamchenkov","date":"January 30, 2005","format":false,"excerpt":"I was thinking about syndicating my del.icio.us bookmarks into the blog, but never implemented it. Today I stumbled upon this post which explains how to syndicate del.icio.us into Movable Types. The Perl script used is a dirty hack. Of course, I had to immidiately correct and improve the situation. My\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":8090,"url":"https:\/\/mamchenkov.net\/wordpress\/2004\/10\/21\/fmtyewtk-about-mass-edits-in-perl\/","url_meta":{"origin":9073,"position":4},"title":"FMTYEWTK About Mass Edits In Perl","author":"Leonid Mamchenkov","date":"October 21, 2004","format":false,"excerpt":"There is a very usefule article on Perl.com - \"FMTYEWTK About Mass Edits In Perl\". It is about making changes in a bunch of files using a simple Perl script, or a one-liner, or even straight from command line. All the information is old, but it is nicely collected in\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":9592,"url":"https:\/\/mamchenkov.net\/wordpress\/2005\/10\/20\/synchronizing-directories-with-perl-and-ssh\/","url_meta":{"origin":9073,"position":5},"title":"Synchronizing directories with Perl and SSH","author":"Leonid Mamchenkov","date":"October 20, 2005","format":false,"excerpt":"For a while now I have been using ICQ both at home and at work. Instead of having two different copies of data or running ICQ remotely, I was simply copying all data files over between these two locations. rsync with scp were doing the job just fine. The problem\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_sharing_enabled":true,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/posts\/9073","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/comments?post=9073"}],"version-history":[{"count":0,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/posts\/9073\/revisions"}],"wp:attachment":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/media?parent=9073"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/categories?post=9073"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/tags?post=9073"},{"taxonomy":"keyring_services","embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/keyring_services?post=9073"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}