Question

I've this problem:

I'm trying to send an email from the command line but if I do:

mailto: example@rat.it?subject=subject&body=body

The cmd returns me: "body" non è riconosciuto come comando interno o esterno, un programma eseguibile o un file batch.

I only manage to write an email with the subject and without the body, How can I add the Body?

Please help me

Was it helpful?

Solution

almost there...

This works:

  start mailto:"example@rat.it?subject=subject&body=body"

EDIT: but it puts an extra "to the beginning of the address... (you can avoid the extra " at the end of the body by inserting a space in front of it)

EDIT2: but this works:

start "" "mailto:example@rat.it?subject=subject&body=body "

OTHER TIPS

The Interlink mail client does this. https://binaryoutcast.com/projects/interlink

  • To describe Interlink:
    • works like classic Thunderbird, but better
    • under current development
    • longstanding TB bugs have been fixed
    • not a clone, and not a recent fork

From the docs at http://kb.mozillazine.org/Command_line_arguments_%28Thunderbird%29 and testing on Windows:

d:\Path\Interlink.EXE -compose ^
"from='From Name ^<FromBox@FromDomain.com^>'^
,to='To Name One ^<ToBoxOne@ToDomainOne.com^>, To Name Two ^<ToBoxTwo@ToDomainTwo.com^>'^
,cc='CC Name One ^<CCBoxOne@CCDomainOne.com^>, CC Name Two ^<CCBoxTwo@CCDomainTwo.com^>'^
,bcc='BC Name One ^<BCBoxOne@BCDomainOne.com^>, BC Name Two ^<BCBoxTwo@BCDomainTwo.com^>'^
,subject='Your Subject Here'^
,message='d:\Path\Body File.htm',^
,attachment='^
d:\Path\Attach One.PDF,^
d:\Path\Attach Two.PDF^
'"

Line continuation is for readability and bat/cmd files, but also works correctly. The angle brackets do not need to be escaped inside single-quotes in a Set statement.

BUG: The from-address must exist in an Identity, or else the resulting compose window will be empty. This bug was filed in the queue around July 2020. When the from-address is found in an Identity, the From-Name is copied from the Identity, and the From-Name on the command line is ignored.

Syntax:

  • The entire list of arguments to -compose is enclosed in double-quotes. Within the argument-list, the arguments are separated by commas; the commas can-not be led nor followed by spaces. When the argument-list contains only one argument, and that argument contains zero spaces or angle brackets, enclosing it in double-quotes is optional.

  • Within an argument, the list of values is enclosed in single-quotes. Within a value-list, the values are separated by commas; the commas can-yes be followed by spaces. When a value-list contains only one value, and that value contains zero spaces or angle brackets, enclosing it in single-quotes is optional.

  • Some arguments will accept all values in a value-list: to=, cc=, bcc=, attachment=

  • Some arguments will accept only the first value in a value-list: from=, subject=, body=, message=; following values are ignored.

  • If both message= and body= are specified, then body= is ignored.

Thunderbird is likely compatible.

Get the executable pathname from the registry into an environment variable with:

For /F "Tokens=3" %%A In ('Reg Query HKEY_CLASSES_ROOT\mailto\shell\open\command') Do Set MailerEXE=%%A
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top