Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to send mail from command line?

2 views
Skip to first unread message

Shahril

unread,
Aug 11, 2003, 10:03:10 PM8/11/03
to
Hi folks,

I wish to automate sending of mails, so want to create a
batch file.

The manual way is as follows:
telnet localhost 25
helo me
mail from:ro...@msfsr.mycompanydomain
rcpt to:shah...@appprod.mycompanydomain
Data
Subject:This is a test

Testing

.
quit

How do I make it into a batch file or script?


TIA & Rgds,
Shahril

Oli Restorick [MVP]

unread,
Aug 12, 2003, 2:23:52 AM8/12/03
to
Look up the "blat" utility on Google.

Oli

"Shahril" <shah...@spower.com.sg> wrote in message
news:073001c36075$e16ea1f0$a401...@phx.gbl...

Michael Bednarek

unread,
Aug 12, 2003, 4:42:59 AM8/12/03
to
On Mon, 11 Aug 2003 19:03:10 -0700, "Shahril" <shah...@spower.com.sg>
wrote in microsoft.public.win2000.cmdprompt.admin:

I don't think there is a way of scripting the standard Microsoft
telnet client (although some people in the past have come up with some
VB scripts which issued SendKeys commands - ugly).

I suggest you use a comms program, and among those I would use Kermit.
See : http://www.columbia.edu/kermit/ckermit.html and
http://www.columbia.edu/kermit/ckscripts.html
Unfortunately, the Win32 version (Kermit95) is not free; you'll
probably find others which are, but I can't comment on those.

--
Michael Bednarek, IT Manager, Tactical Global Management
Waterfront Pl, Brisbane 4000, Australia. "POST NO BILLS"
http://mcmbednarek.tripod.com/

Birol AKBAY

unread,
Aug 12, 2003, 8:44:12 AM8/12/03
to
Hi,
Use vbs file to send emails.
Use command line arguments to send variables,
But i don't remember how to get command line arguments
right now :(

set mail = createobject("CDONTS.NewMail")
mail.to = "te...@test.com"
mail.from = "fr...@test.com"
mail.body = body
mail.subject = subject
mail.send

set mail = nothing

>-----Original Message-----
>Hi folks,
>
>I wish to automate sending of mails, so want to create a
>batch file.
>
>The manual way is as follows:
>telnet localhost 25
>helo me
>mail from:ro...@msfsr.mycompanydomain
>rcpt to:shah...@appprod.mycompanydomain
>Data
>Subject:This is a test
>
>Testing
>

>..

>quit
>
>How do I make it into a batch file or script?
>
>
>TIA & Rgds,
>Shahril
>

>.
>

Levent

unread,
Aug 13, 2003, 3:26:27 AM8/13/03
to
You can also use "postie".
(http://www.infradig.com/postie/index.shtml) Regards.

Michael Bednarek

unread,
Aug 13, 2003, 9:35:05 PM8/13/03
to
On Tue, 12 Aug 2003 05:44:12 -0700, "Birol AKBAY" <ak...@tr.net> wrote
in microsoft.public.win2000.cmdprompt.admin:

>Hi,
>Use vbs file to send emails.
>Use command line arguments to send variables,
>But i don't remember how to get command line arguments
>right now :(
>
>set mail = createobject("CDONTS.NewMail")
>mail.to = "te...@test.com"
>mail.from = "fr...@test.com"
>mail.body = body
>mail.subject = subject
>mail.send
>
>set mail = nothing

I think this requires that the following items are installed:
1. Windows Scripting Host (WSH) - most probably true
2. IIS or Exchange - unlikely

And what about this remark: "Please avoid using CDONTS.NewMail... it
is wrought with problems, and is obsolete (it is no longer included in
Windows XP or Windows Server 2003)." from
http://www.aspfaq.com/show.asp?id=2119.

Michael Bednarek

unread,
Aug 13, 2003, 9:35:39 PM8/13/03
to
On Mon, 11 Aug 2003 19:03:10 -0700, "Shahril" <shah...@spower.com.sg>
wrote in microsoft.public.win2000.cmdprompt.admin:

Which mail server?

Don Quixote

unread,
Aug 17, 2003, 12:32:48 AM8/17/03
to
I am smelling Spam...


On Thu, 14 Aug 2003 01:35:39 GMT, Michael Bednarek <m...@tgm.com.au>
wrote:

Herb Martin

unread,
Aug 18, 2003, 7:00:19 AM8/18/03
to

"Don Quixote" <dro...@socal.rr.com> wrote in message
news:mrusjv0fs2eqqf1ea...@4ax.com...
> I am smelling Spam...

Maybe but probably not; he wants to contact an SMTP server manually
which is the WORST way to send spam. Ok, in a batch it is a little
better but there are plenty of programs that automate this much better,
even Outlook or Outlook Express can use long CC: or distribution
lists.

He probably wants to test the email server or just doen't
have an email user agent (client program) on a particular
machine.

> >>I wish to automate sending of mails, so want to create a
> >>batch file.
> >>
> >>The manual way is as follows:
> >>telnet localhost 25
> >>helo me
> >>mail from:ro...@msfsr.mycompanydomain
> >>rcpt to:shah...@appprod.mycompanydomain
> >>Data
> >>Subject:This is a test
> >>
> >>Testing
> >>
> >>.
> >>quit
> >>
> >>How do I make it into a batch file or script?
> >
> >Which mail server?

YOUR approved email server -- the same SMTP
server you would use if you were setting up Outlook,
or your favorite email client program.

You put all the stuff in a text file and use the COMMAND
line version of Telnet or better yet, NetCat (nc.exe).

What are you REALLY trying to accomplish with this
and we can tell you the best tool.


Timothy M Hodgson

unread,
Aug 18, 2003, 10:45:36 AM8/18/03
to
Hi,

Your best bet is to use a DOS mailer tool that will handle this for
you, easily. Try this command line email program for Windows,
NetMailBot:

http://www.netmailbot.com

"Shahril" <shah...@spower.com.sg> wrote in message news:<073001c36075$e16ea1f0$a401...@phx.gbl>...

Herb Martin

unread,
Aug 19, 2003, 2:54:08 AM8/19/03
to
>
> Your best bet is to use a DOS mailer tool that will handle this for
> you, easily. Try this command line email program for Windows,
> NetMailBot:

You might want to go a bit cheaper...as in free.

Blat (version 1.94)
> http://www.interlog.com/~tcharron/blat.html

Microsoft's Smplmapi (sounds like MAPI instead of SMTP and
I haven't tried it)
> http://pages.infinit.net/che/blat/blat.html#download

And of course just a script fed to NetCat
> http://packetstormsecurity.nl/UNIX/netcat/
> http://packetstormsecurity.nl/UNIX/netcat/nc11nt.zip

0 new messages