Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I was reading Perl Script, MS OutLook and saw a link posted to How do I send e-mail from my Perl Program?. I used the example code and it worked (see below). Can I send e-mail with attachments (Excel, Word, etc.) using this stanard version of Perl (This is perl, v5.6.1 built for MSWin32-x86-multi-thread)? That is, can I do it without CPAN downloads?
Thanks.
use strict; use warnings; use Net::SMTP; my $smtp = Net::SMTP->new('MAILSERVER') or die $!; my ($from, $to) = ('blah@domain.com', 'user@otherdomain.com'); my ($subject, $message) = ('Test subject', 'Test message'); $smtp->mail( $from ); $smtp->to( $to ); $smtp->data(); $smtp->datasend("To: $to\n"); $smtp->datasend("From: $from\n"); $smtp->datasend("Subject: $subject\n"); $smtp->datasend("\n"); # done with header $smtp->datasend($message); $smtp->dataend(); $smtp->quit(); # all done. message sent.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Sending e-mail with attachments.
by periapt (Hermit) on Jun 08, 2004 at 18:55 UTC | |
Re: Sending e-mail with attachments.
by drewbie (Chaplain) on Jun 08, 2004 at 19:26 UTC | |
Re: Sending e-mail with attachments.
by eclark (Scribe) on Jun 08, 2004 at 18:30 UTC | |
Re: Sending e-mail with attachments.
by vek (Prior) on Jun 08, 2004 at 18:58 UTC | |
Re: Sending e-mail with attachments.
by runrig (Abbot) on Jun 08, 2004 at 19:17 UTC |
Back to
Seekers of Perl Wisdom