Beefy Boxes and Bandwidth Generously Provided by pair Networks httptech
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: How do I send e-mail from my Perl Program?

by Adam (Vicar)
on Oct 13, 2000 at 01:14 UTC ( [id://36544]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to How do I send e-mail from my Perl Program?

use strict; # ALWAYS! use Net::SMTP; # Yes, this will work on windows. # You need to fill in the variables. # Read the perldoc for more info on using SMTP. my $smtp = Net::SMTP->new('$mailserver_url') or die $!; $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: Answer: How do I send e-mail from my Perl Program?
by cLive ;-) (Prior) on Jan 14, 2002 at 05:16 UTC
    Small error:
    my $smtp = Net::SMTP->new('$mailserver_url') or die $!;
    should be:
    my $smtp = Net::SMTP->new($mailserver_url) or die $!;
    or
    my $smtp = Net::SMTP->new("$mailserver_url") or die $!;
    Single quotes aren't interpolated!

    cLive ;-)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://36544]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.