{"id":7437,"date":"2021-10-18T00:24:20","date_gmt":"2021-10-18T00:24:20","guid":{"rendered":"https:\/\/max-drake.cc\/?p=7437"},"modified":"2021-10-18T06:44:41","modified_gmt":"2021-10-18T06:44:41","slug":"maxlauncher-and-sending-html-emails-via-script","status":"publish","type":"post","link":"https:\/\/max-drake.cc\/?p=7437","title":{"rendered":"MaxLauncher and sending HTML emails via script"},"content":{"rendered":"\n<p>In the previous article <strong><a rel=\"noreferrer noopener\" href=\"https:\/\/max-drake.cc\/?p=7425\" target=\"_blank\">MaxLauncher &amp; sending emails in Thunderbird with mailto:<\/a><\/strong> I used my default email application to setup a new Template to send emails. <\/p>\n\n\n\n<p>I was able to add a few signatures to in the body of the text so that I could just delete the ones I didn&#8217;t want. As well as a note for Attachment if there was one, again, if not required then I&#8217;d delete that line. <\/p>\n\n\n\n<p>After all its easier to delete than to write out fully. <\/p>\n\n\n\n<p>The nice thing with the Mailto: approach is that you can use Emojis in the Subject line to make the Topic stand out when sending to others (<em>just remember to save the .ahk script file in encoded UTF-8_BOM instead of the UTF-8 encoding)<\/em><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"697\" data-src=\"https:\/\/max-drake.cc\/wp-content\/uploads\/2021\/10\/2021-10-18-12_32_09-Add-New-Post-\u2039-Vast-\u2014-WordPress-\u2014-Mozilla-Firefox-1024x697.jpg\" alt=\"\" class=\"wp-image-7438 lazyload\" data-srcset=\"https:\/\/max-drake.cc\/wp-content\/uploads\/2021\/10\/2021-10-18-12_32_09-Add-New-Post-\u2039-Vast-\u2014-WordPress-\u2014-Mozilla-Firefox-1024x697.jpg 1024w, https:\/\/max-drake.cc\/wp-content\/uploads\/2021\/10\/2021-10-18-12_32_09-Add-New-Post-\u2039-Vast-\u2014-WordPress-\u2014-Mozilla-Firefox-300x204.jpg 300w, https:\/\/max-drake.cc\/wp-content\/uploads\/2021\/10\/2021-10-18-12_32_09-Add-New-Post-\u2039-Vast-\u2014-WordPress-\u2014-Mozilla-Firefox-768x523.jpg 768w, https:\/\/max-drake.cc\/wp-content\/uploads\/2021\/10\/2021-10-18-12_32_09-Add-New-Post-\u2039-Vast-\u2014-WordPress-\u2014-Mozilla-Firefox-50x34.jpg 50w, https:\/\/max-drake.cc\/wp-content\/uploads\/2021\/10\/2021-10-18-12_32_09-Add-New-Post-\u2039-Vast-\u2014-WordPress-\u2014-Mozilla-Firefox-73x50.jpg 73w, https:\/\/max-drake.cc\/wp-content\/uploads\/2021\/10\/2021-10-18-12_32_09-Add-New-Post-\u2039-Vast-\u2014-WordPress-\u2014-Mozilla-Firefox-100x68.jpg 100w, https:\/\/max-drake.cc\/wp-content\/uploads\/2021\/10\/2021-10-18-12_32_09-Add-New-Post-\u2039-Vast-\u2014-WordPress-\u2014-Mozilla-Firefox-147x100.jpg 147w, https:\/\/max-drake.cc\/wp-content\/uploads\/2021\/10\/2021-10-18-12_32_09-Add-New-Post-\u2039-Vast-\u2014-WordPress-\u2014-Mozilla-Firefox-940x640.jpg 940w, https:\/\/max-drake.cc\/wp-content\/uploads\/2021\/10\/2021-10-18-12_32_09-Add-New-Post-\u2039-Vast-\u2014-WordPress-\u2014-Mozilla-Firefox-640x436.jpg 640w, https:\/\/max-drake.cc\/wp-content\/uploads\/2021\/10\/2021-10-18-12_32_09-Add-New-Post-\u2039-Vast-\u2014-WordPress-\u2014-Mozilla-Firefox-1128x768.jpg 1128w, https:\/\/max-drake.cc\/wp-content\/uploads\/2021\/10\/2021-10-18-12_32_09-Add-New-Post-\u2039-Vast-\u2014-WordPress-\u2014-Mozilla-Firefox.jpg 1508w\" data-sizes=\"(max-width: 1024px) 100vw, 1024px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 1024px; --smush-placeholder-aspect-ratio: 1024\/697;\" \/><\/figure>\n\n\n\n<p>So the template can be setup for a few variations but in it it has :<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>FROM (my preferred email to send FROM<\/li><li>TO prefilled, I can have a couple of Templates  for different people I regularly email to &amp; can add CC &amp; BCC if I want<\/li><li>In SUBJECT Emoji icons to make email stand out in recipients inbox<\/li><li>Start the Body with Dear for standard greeting<\/li><li>A note for Attach, this triggers Thunderbird to look for attachment &amp; add yellow highlight bar at bottom<\/li><li>A few different simple signatures, I&#8217;m personally not keen on images in signatures as they bloat the mail files, so I personally don&#8217;t use them. I also have hotkeys to put these in for me if I want. <\/li><\/ol>\n\n\n\n<p>So this meets most of my requirements, apart from being able to put HTML into the body of the text as a signature automatically with the mailto: process<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>em1=DingDong@gmail.com\nem2= Trala@pir2.com\nem3= SomeoneElse@gmail.com\nSubj= ?\ufe0fthe tree is green\n\n\n\nBod= The message's first paragraph.`%0ASecond paragraph.`%0AThird Paragraph`%0\nRun, mailto:%em1%?cc=%em2%&amp;cc=%em3%&amp;bcc=%em3%&amp;subject=%Subj%&amp;body=%Bod%       \n\nReturn<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">HTML in Emails &amp; sending via scripts<\/h2>\n\n\n\n<p>So I have the mailto template that I can use with MaxLauncher with Thunderbird , but my formasl signature is a bit of html code with buttons and lots of colours. So I&#8217;d like to be able to add HTML. <\/p>\n\n\n\n<p>I came across 2 videos, one by Joe Glines and one by Juho Lee, see  below, that allowed you to pre-set up your email and then send it programmatically via running a script. <\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe title=\"Email Sender using CDO and Gmail with AutoHotkey\" width=\"678\" height=\"381\" data-src=\"https:\/\/www.youtube.com\/embed\/_hMtU9XHTgM?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" data-load-mode=\"1\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe title=\"[Juho&#039;s Random AutoHotkey Stuff #18] Send an Email Without MS Outlook\" width=\"678\" height=\"381\" data-src=\"https:\/\/www.youtube.com\/embed\/f5H-KEcs-e4?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" data-load-mode=\"1\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<p>I tried both scripts, they have some added features over the mailto: process in previous article, these are: <\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>You can preset all the addresses <\/li><li>You can add attachments <\/li><li>You can write HTML in the body of the text<\/li><li>You can have multiple main people to email to (I haven&#8217;t been able to get this to work with mailto: but apparently it can be done)<\/li><\/ol>\n\n\n\n<p><strong>Negatives<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Cannot put emojis into Subject header<\/li><li>you need to setup your password so  that it can be fed into the script<\/li><li>The HTML inside the script can be a bit unwieldy- see this article (https:\/\/www.reddit.com\/r\/AutoHotkey\/comments\/45eed1\/automating_an_html_outlook_email_with_autohotkey\/)<\/li><\/ol>\n\n\n\n<p>I am happy to accept some of the challenges of the negatives apart from The emoji in the SUBJECT title, it&#8217;s a fad I&#8217;m going through and I like using it. So  for the time being <\/p>\n\n\n\n<p>I used my gmail address to run the scripts from and adjusted my gmail account to allow this to work. <\/p>\n\n\n\n<p>A couple of things with the 2 scripts: <\/p>\n\n\n\n<p>In Juhos it gives a pop-up box for you to enter your password in before sending the email. A good idea apart from having to hit the OK button prior to sending, one step too many<\/p>\n\n\n\n<p>In the Glines script it works on the password being in an ini file that it reads, so you can locate the ini file in another location. I like this method better as once its setup you don&#8217;t have to think about it. <\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Reading another file for input information<\/h4>\n\n\n\n<p>I&#8217;m wondering if it might be possible to have a separate file with the data for the email so the script just reads that instead. <\/p>\n\n\n\n<p>The reason I say that is, when I was doing my HTML signature trying to sendInput all the information it took ages to type it out at the bottom of the email. I ended up just putting it in a file and calling that file, that method was really fast. <\/p>\n\n\n\n<p>Following on from that, maybe a Pop-up GUI with input fields so that you can add all your requirements into input fields (starting to develop into an email program.<\/p>\n\n\n\n<p>Maybe there could just be some preset HTML stuff, top and bottom of page and then just straight text in the middle, so preset stuff fired in from a file and then add the normal text in later. <\/p>\n\n\n\n<p>Final script <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\n#SingleInstance,Force ;run only once\n;+++++SET PAUSE TIME VAR++++++++++\ntimeS=1000   ;pause time between actions \n\n\n;+++++SET EMAIL ADDRESSES++++++++++ see RULES above\nem1= helloDolly@gmail.com ;TO\nem2=        ;CC\nem3=         ;CC &amp; BCC \nSubj= ?    ; This emoji default for window search Winactivate\n\n\n\nBod= Dear   ; Text Body (Plain Text)\n\nRun, mailto:%em1%?cc=%em2%&amp;cc=%em3%&amp;bcc=%em3%&amp;subject=%Subj%&amp;body=%Bod%        \n\n\nFileRead, OutputVar, E-fullSignature.txt\n\t; sleep, 500\nclipboard := \"\"   ; Give the clipboard entirely new contents.\nclipboard := OutputVar  ; Empty the clipboard.\n \nWinActivate, Write: ? - Thunderbird\n\nsleep, 2000 ;%timeS%\nsend, !I\nsleep, %timeS%\nsend, {Down 5}\nsleep, %timeS%\nsend, {Enter}\nsleep, %timeS%\nsend, ^v \n send, {Tab}  \n send, {Enter}\nReturn<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">End comment<\/h2>\n\n\n\n<p>Overall I&#8217;ll stick with the mailto method, I can always add my HTML signature in by Hotkeys as I can have emojis in the SUBJECT line. <\/p>\n\n\n\n<p>If I&#8217;m doing mass send-outs or want to automate the task I&#8217;ll look at using the Glines method , purely from the point of the password being setup once. I think the scripts are pretty similar apart from that. <\/p>\n\n\n\n<p>The attachments is a handy feature too. <\/p>\n\n\n\n<p>In the last segment I was thinking about some alternative methods for body text but the question is how much effort to put into this? Is it worth the returns or is it just for occasional use? <\/p>\n\n\n\n\n\n\n\n\n\n\n\n\n","protected":false},"excerpt":{"rendered":"<p>In the previous article MaxLauncher &amp; sending emails in Thunderbird with mailto: I used my default email application to setup a new Template to send emails. I was able to add a few signatures to in the body of the text so that I could just delete the ones I didn&#8217;t want. As well as [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":7438,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[466,204,42],"tags":[],"class_list":["post-7437","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-autohotkey","category-automation","category-productivity"],"featured_image_src":"https:\/\/max-drake.cc\/wp-content\/uploads\/2021\/10\/2021-10-18-12_32_09-Add-New-Post-\u2039-Vast-\u2014-WordPress-\u2014-Mozilla-Firefox-600x400.jpg","featured_image_src_square":"https:\/\/max-drake.cc\/wp-content\/uploads\/2021\/10\/2021-10-18-12_32_09-Add-New-Post-\u2039-Vast-\u2014-WordPress-\u2014-Mozilla-Firefox-600x600.jpg","author_info":{"display_name":"Max Drake","author_link":"https:\/\/max-drake.cc\/?author=1"},"_links":{"self":[{"href":"https:\/\/max-drake.cc\/index.php?rest_route=\/wp\/v2\/posts\/7437","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/max-drake.cc\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/max-drake.cc\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/max-drake.cc\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/max-drake.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7437"}],"version-history":[{"count":0,"href":"https:\/\/max-drake.cc\/index.php?rest_route=\/wp\/v2\/posts\/7437\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/max-drake.cc\/index.php?rest_route=\/wp\/v2\/media\/7438"}],"wp:attachment":[{"href":"https:\/\/max-drake.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7437"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/max-drake.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7437"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/max-drake.cc\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7437"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}