Sending E-mail Attachments From NT Command Line?
Losing my love of PERL asks: "OK, here's the skinny: I've been trying to figure this out for quite a while now, and nothing is working. I need to send a proper e-mail attachment (i.e. something that will show up as a paper clip in Outlook) from an NT command line to be called by a PERL script (or better yet, just sent by the script). I've tried several modules and programs, including Blat, Mail::Sender, Mail::Sendmail, but every time the attachment is just shoved into the body of the e-mail. Does anyone have a solution to my problems?"
you can try MIME::LITE, it's a perl modukle that is just for that.
/www.perl.com/CPAN-local/modules/by-module/MIME/MI ME-Lite-1.137.readme or
haven't used it under NT so I cannot say if there is are any funkiness or porting that needs to be done with it.
Check CPAN:
http:/
http://www.perl.com/CPAN-loc al/modules/by-module/MIME/
this space for rent
Does the script have to use PERL? If not, you could try using MAILTO, a free 10 kb program available from winfiles.com that allows you to send SMTP mail from a commandline. You need an SMTP server available somewhere on your network. Or if Microsoft Exchange is the backend, then I have a VBScript script that can be invoked via Windows Scripting Host to send a piece of mail (plus an attachment). Email me off of the list if you want to get it: alastair@hsnz.co.nz
-- "I believe the human being and the fish can coexist peacefully." - George W. Bush, 29 September 2000
its time to use a real scripting language called VB (script, that is). The method you want to call is CDONT.NewMail. Search the KB for details on how it works.
ÕÕ
Grab a copy of mpack from ftp://ftp.andrew.cmu.edu/pub/mpack/
Firstly, Outlook sometimes puts the attachment in the body. That's just how it works. If you don't want it to happen you'll have to specify a MIME type it doesn't recognise, or zip up your file. It will do this with HTML or text attachments. Netscape Messenger does the same thing.
Having said all that, Mail::Sender works extremely well, even if the code is a bit spaghetti-ish. And does attachments just fine.
Matt. Want XML + Apache + Stylesheets? Get AxKit.
It's not that hard to put something in an attachment rather then in the body. any attachment is simply included in the body with separators. These separators can easily be built up by hand. dependant on the file, you may have to run uuencode over it though. This approach worked perfectly for me, is platform-independant and also not dependant on any overbloated application.
//rdj
No one can understand the truth until he drinks of coffee's frothy goodness.
--Sheikh Abd-Al-Kadir, 1587
50% of viruses/trojans are written in VBscript now.
- A.P.
--
"One World, one Web, one Program" - Microsoft promotional ad
"Remember when the U.S. had a drug problem, and then we declared a War On Drugs, and now you can't buy drugs anymore?"
You could try looking at the following site:
http://www.gnu software.com/ilink/ilink.cgi?Category=E-mail%3ASen ding
SteveOh, they provide the source too. Check it:
http://www.interlog.com/~tcharron/blat. html
-the spoony fork
Speak truth to power.