Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sending mail from Windows 2

Status
Not open for further replies.

nix45

MIS
Nov 21, 2002
478
0
0
US
In *nix, its very easy to send mail from the command line if your running a local MTA. In Windows, there aren't any command line utilities to do this that I'm aware of. What is the easiest way to send mail in a Perl script from a Windows machine?

Thanks,
Chris
 
fyi, this Windows server is running IIS with the SMTP service installed.
 
Windows, I wouldn't have a clue. Have a look on search.cpan.org


HTH
--Paul
 
Forget sendmail, just use Net::SMTP

This will work on most platforms. sendmail is error prone and very platform specific with implementations and security options varying per OS installation. Bonus, you get real debugging with Net::SMTP.

If you HATE external perl modules for some irrational reason you can use 'blat'. Search on google for it, its a nice sendmail replacement for windows

But seriously, Net::SMTP is awesome!
 
I have no intentions of installing sendmail on Windows, I don't even like it on *nix:) I prefer Postfix on *nix systems.

I read in a book that Net::SMTP was the way to go, but I wanted to get an experts opinion without giving any idea's first. I just taught myself Perl this week and don't know anything about object oriented programming, which is what Net::SMTP uses. Can you please give me a quick example of how to send mail using that module? The examples in the Net::SMTP man page don't seem to work when you cut and paste and fill in your own values.

Thanks,
Chris
 
Those examples work great for me. Turn on debug and see what error you are getting.

$smtp = Net::SMTP->new('mailhost', Debug=>1);

With Debug on Net::SMTP will stream the transactions to STDERR and you can see whats going on. I imagine its some local mailserver problem.

I do not advocate tying code to any specific mailer. Its makes it non-portable. Using Net::SMTP and going direct to the SMTP server makes it portable and removes all the OS/MTA nastiness.
 
It does work, the problem was that I needed to enclose the email address with ''.

Do you know of any good links on learning Object Orientated Programming with Perl? I can reverse engineer the example in the man page, but I would like to actually understand what each line does:)

Thanks for your help,
Chris
 
MIME::Lite + Net::SMTP works great for multipart docs, HTML formatted email and attachments. I use it all the time and love it!
 
Ok, I'll try them both out and see which one I like better.

Thanks,
Chris
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top