MaxLauncher & sending emails in Thunderbird with mailto:

I’ve just spend a few hours trying to figure out a hotkey script to send emails at a touch of a MaxLauncher key to Thunderbird.

My initial objective is to have a DEFAULT sender address, a set TO email ( I can have multiple buttons for different addressee’s if they are common or just a blank one, and then to land in the Subject box so that I could start the email.

A later requirement will be to give different signatures to the emails from a selection, maybe different buttons on MaxLauncher

Selecting the FROM email address

The issue was making sure they all came FROM the same account. In Thunderbird if you have your cursor on a different account (I have multiple accounts in Thunderbird ) and then hit Write button to create a new email, it will send it from the account you have highlighted.

I wanted to ensure that they all came FROM the same account, so I had a DEFAULT setup and could alter it if I wanted.

Thunderbird has shortcut keys but they are fixed and some of them toggle rather than go to a definitive place.

My first effort was to activate Thunderbird and then on a new email( Ctrl+m) go to FROM and write in the sender address.

New message Shift Tab to FROM – not successful

As soon as it starts a new email it goes to the TO cell, and it already has a FROM based on which folder account you are in already. So you have to do Shift+Tab to go back 4 times to get to the FROM tab, then CLICK then use UP arrow a few times, to make sure you are in the first email address.

I couldn’t get that to work reliably at all.

I found I could use Alt+R to get to the From Field, and even with Click and send {up 4} I still couldn’t ensure the correct FROM consistently.

Start in correct Folder then send message- no joy

Next, I wanted to go to the Folder column that lists all the accounts and their folders on the left but I could only use a toggle key, so I could be in the top right hand panel, the bottom right hand panel or the right panel.

So depending on where you start you’d need to toggle the key a different amount of times.

I wanted to be on the Left panel and then go to the top and then use the top email address. So I couldn’t get that reliably

So no success.

Plugins?

I looked at plugins to Thunderbird that would allow me to alter hotkeys or make ones that would help me in what I was doing. I didn’t want to go down that path initially, as I’d have to configure it for 3 PC’s at least. Also the Thunderbird add-ins sometimes are updated, sometimes not.

Jack’s AutoHotkey Blog comes to the rescue

A “DUH!!!!” moment for me, in his post Send E-Mail Using AutoHotkey-Automating the E-Mail Process Can Make Regular Notifications Easy he suggests :

Run, Mailto: thisIdiot@aDefinitMoron.com

One line of code and it does it all. It uses my default email program: Thunderbird , it seems to default to the FROM account at the top of my email folder list: HURRAY, and you can set the TO: ThisIdiot@Stupidity.com and it drops you into the Subject box of the email.

It meets all my objectives and is simple.

can you CC & BCC as well? Yes you can

So there are some emails I send to one person and CC others , to keep them in the loop, you can add the cc in the mailto and add parameters , see this article as well as adding Subject & body info as well.

I’ll have to explore that to see if I can add emoji’s to it to highlight its come from me.

Subject & Body and line break

You can also add subject and body too, and there is a process, using `%0A (that’s a Tilda key at the front) to add a line break in the Text body.

Originally you could add an attachment file but that has been blocked in recent years.

So code below for AHK script to put on a MaxLauncher key to launch an email using mailto:


em1= Blah@trogs.com
em2= Trala@pir2.com
em3= SomeoneElse@gmail.com
Subj= ?️the tree is green



Bod= The message's first paragraph.`%0ASecond paragraph.`%0AThird Paragraph`%0
Run, mailto:%em1%?to=%em2%&cc=%em2%&cc=%em3%&bcc=%em3%&subject=%Subj%&body=%Bod%       

Return

RULES

  1. Save SCRIPT File as encoding UTF-8-BOM (for Emojis?️) to work
  2. Only ONE MAILTO recipient unless you add “to=” for subsequent recipients- mailto:%em1%?to=%em2%
  3. CC’s fpr 2nd need to add &cc=%em3% mailto:%em1%?cc=%em2%&cc=%em3%
  4. Subject needs &subject=
  5. Body needs &body=
  6. New line in Body needs `%0A to start new line `%0ASecond paragraph.`%0AThird
    (see ;https://www.autohotkey.com/board/topic/42234-how-to-enter-more-than-one-line-in-text-body/)
  7. attach= C:/txt.txt ; doesn’t work in later emails (Win 10)

Inserting HTML into message

When the message has opened you do have the opportunity to use Alt

End comment

Sometimes I feel so T’ick.

Its such an obvious solution. This is a case of not seeing the wood for the trees.

Thank you Jack for sharing, I’m feeling humble

So this allows for an easy setup for sending an email with a script. So a good simple solution.

The next steps are:

  • being able to put HTML into the email
  • Choosing different signatures for the emails

There seems to be some paths to explore :

This article on putting HTML into a Thunderbird email message,

Jo Glines vid which has HTML,

And Juho’s email vid: