Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: How do I send an email with Perl (including an attachment)?

by jcwren (Prior)
on Jun 22, 2000 at 17:50 UTC ( [id://19433]=note: print w/replies, xml ) Need Help??


in reply to How do I send an email with Perl (including an attachment)?

Here's a basic sample that sends a message, without a file attachment. Net::SMTP is the key.
#!/usr/local/bin/perl -w use strict; use Net::SMTP; { my $sender = 0; $sender = Net::SMTP->new ('smtp.mailserver.pm'); $sender->mail ('perlmonk@themonastery.org'); $sender->to ('goddesses@themonastery.org'); $sender->data (); $sender->datasend ("From: perlmonk\@themonastery.org\n"); $sender->datasend ("To: goddesses\@themonastery.org\n"); $sender->datasend ("Subject: Promotions\n"); $sender->datasend ("\n"); $sender->datasend ("Please vote my articles up, I need the XP"\n\n") +; $sender->dataend; $sender->quit; }
I'll have to let other people tell/show you how to send a file attachment, although I would take a look at Mail::Sender. It looks pretty easy to use. I've never had to mess with that.

--Chris

Originally posted as a Categorized Answer.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://19433]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (5)
As of 2024-03-28 16:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found