I'm trying to send email from a visual basic script using Visual basic WITHOUT any user action. The idea came for the first reference below.
http://forums.mozillazine.org/viewtopic.php?f=39&t=540783
http://forums.mozillazine.org/viewtopic.php?t=203591
https://developer.mozilla.org/en-US/docs/Mozilla/Command_Line_Options#-options
The script does work BUT I have been unable to figure out how to include attachments. I know little about VB but in the first reference the mixture of " and chr(34) (" I assume) seems very weird. Also the discrepancy between "mailto" and "to" between the first and third reference is troubling.
Here's what I have tried.
dim s
Set s = CreateObject("WScript.Shell")
s.run """thunderbird.exe""" & " -compose mailto:mdorl@wisc.edu? &subject=""send mail 3""&body=""nice body text""&attachment='file:///c:/Documents and Settings/Mike/My Documents/sendmail/vb/msg.txt'"
WScript.Sleep 1000
s.SendKeys "^{ENTER}"
WScript.Sleep 1000
This composes and sends an email without user action BUT without the attachment. I have tried both single and double quotes around the file name.
If I change the file name to a non-existent file, an email is send without attachment BUT user action is required to actually send the message.
edited my answer since I've been learning a thing or two these last couple of weeks ;)
you need an apostrophe around to: and cc: lists with more than one recipient you also need an apostrophe around any main body text or attachments you're going to send
if you put an apostrophe into your VBA editor, it just comments it out, so you can get away with that by using Chr(39)
also, as the documentation suggests, you need attachment='file:///c:/test.txt' which includes the file:///
I've included an example from something I've been working on below
Hope that helps :)
Write proper programs. You can't send attachments with mailto. The standard only allows one parameter (although everyone accepts many).