Computer Hope

Microsoft => Microsoft DOS => Topic started by: OutThere on August 20, 2008, 01:30:01 PM

Title: using MSMTP from the command line
Post by: OutThere on August 20, 2008, 01:30:01 PM
I need to send an email from the command line/batch script. I am currently using MSMTP for this. I'd be willing to change BUT the program MUST be able to send using a Gmail account.

I've got MSMTP configured and use the following to send a message:
echo Subject: Hi | msmtp [email protected]
or:
msmtp [email protected] < C:\message
where C:\message contains:
Subject: Hi

I have tried just about EVERYTHING to get a body in the message, trying Body:, Text:, and Message:, placing these under or after the Subject: (Subject: works fine by the way)

any ideas?
Title: Re: using MSMTP from the command line
Post by: fireballs on August 20, 2008, 02:15:41 PM
presumably you've read through the documentation for MSMTP? http://msmtp.sourceforge.net/doc/msmtp.html (http://msmtp.sourceforge.net/doc/msmtp.html) and tried
Code: [Select]
--help

FB
Title: Re: using MSMTP from the command line
Post by: OutThere on August 20, 2008, 02:33:41 PM
yes. MSMTP appears to be designed as a replacement for the program that sends your email normally, i.e., it is designed to be used with annother program, like Mutt. And the documentation contains NO information on using MSMTP, just configuring it! Gack!
Title: Re: using MSMTP from the command line
Post by: fireballs on August 20, 2008, 02:52:43 PM
I'm confused do you still need us?

FB
Title: Re: using MSMTP from the command line
Post by: OutThere on August 20, 2008, 02:57:21 PM
err, yes, I read the docs before posting. they provide NO information on using the app, only on configuring it. I need to know how to use MSMTP from the command line or a batch script. I can get it to send and email with a subject but not with a body. If there is another command line app that can send though a Gmail account, I'll switch to it if it is better.
Title: Re: using MSMTP from the command line
Post by: fireballs on August 20, 2008, 05:02:28 PM
Then sorry i don't think i can help you, though i'm not sure DOS is the best place to look for support... try over in software.

FB
Title: Re: using MSMTP from the command line
Post by: mser on September 29, 2008, 01:08:38 PM
spent a few days on this one.  stick a blank line in your file between subject and the message body.

Subject: my subject

body starts here
line 2
end of body
Title: Re: using MSMTP from the command line
Post by: huwenhuo on May 07, 2009, 09:11:29 AM
yes, it is very useful to send mails as commandline form. and it works as a blank between the subject and other contents. but there still a problem, i cannot found a way to attach additional files when using msmtp.
Title: Re: using MSMTP from the command line
Post by: Dias de verano on May 07, 2009, 11:54:18 AM
i cannot found a way to attach additional files when using msmtp.

Can be done by encoding with base64

Title: Re: using MSMTP from the command line
Post by: huwenhuo on May 07, 2009, 06:08:26 PM
i finally found a better way to send mail at command line

ehco 'mail content' | mutt -s 'subject' -a additionalFileName [email protected]

Title: Re: using MSMTP from the command line
Post by: uSlackr on May 09, 2009, 03:55:09 PM
FWIW, I've used blat for years to send mail from a script.  It works great

Development seems to have slowed, but it is very mature

http://www.blat.net/


\\uSlackr