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?
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
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.
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 mikepro1, thats a good module. This seems like a better method of sending attachments than the one I was about to try using Net::SMTP and MIME::Lite.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.