mailto command line not able to set additional parameters

3

I am trying to create a simple batch file to send an email. I am following steps found online and came up with a simple example like this:

START mailto:john@mail.com?cc=other@mail.com&subject=MySubject&body=MyBody

Running this does open a new email in Outlook with the proper TO and CC fields filled in, but Subject and Body are empty.

In the command window I get the following error output:

'subject' is not recognized as an internal or external command, operable program or batch file. 'body' is not recognized as an internal or external command, operable program or batch file.

I can change the order of the arguments around, and what ever comes after the ? works, but everything after the & fails.

Any idea what is going wrong here?

Thanks!

Goose

Posted 2015-05-13T18:43:55.870

Reputation: 133

Answers

4

Double quotes.

START mailto:john@mail.com?cc=other@mail.com&subject=MySubject&body=MyBody

becomes

START mailto:"john@mail.com?cc=other@mail.com&subject=MySubject&body=MyBody"

armani

Posted 2015-05-13T18:43:55.870

Reputation: 576

1

The ampersand (&) is the character used to separate multiple statements on a single command line. START attempts (and succeeds) to run mailto:john@mail.com?cc=other@mail.com but then attempts to run "subject=MySubject" next and fails, hence the error message about subject not being recognized as a command.

I think "escaping" the ampersand with a carat will also work. For example:

START mailto:john@mail.com?cc=other@mail.com^&subject=MySubject^&body=MyBody

BatchManRay

Posted 2015-05-13T18:43:55.870

Reputation: 11