Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Sending Mail from Perl Script

by skx (Parson)
on Nov 19, 2007 at 06:21 UTC ( [id://651601]=note: print w/replies, xml ) Need Help??


in reply to Sending Mail from Perl Script

The "@" character is special inside quotes, and this is the source of your problem. Either:

a) Escape the symbol:

my $msg = MIME::Lite->new ( From => "user\@gmail.com", To => "user\@gmail.com", Data => "This is a test\n", Subject => "Test", );

or b) Use single-quotes to avoid the interpolation:

my $msg = MIME::Lite->new ( From => 'user@gmail.com', To => 'user@gmail.com', Data => "This is a test\n", Subject => "Test", );
Steve
--

Replies are listed 'Best First'.
Re^2: Sending Mail from Perl Script
by Niner710 (Sexton) on Nov 20, 2007 at 00:56 UTC
    Ok Thanks. That was a dumb error. Corrected that problem but I fail to be able to connect to the mail server. Do you know what else would be wrong with this code?
    use MIME::Lite; $user = 'user@yahoo.com'; $pass = 'passwd'; # Configure smtp server - required one time only MIME::Lite->send("smtp","smtp.mail.yahoo.com", AuthUser=>$user, AuthPass=>$pass); my $msg = MIME::Lite->new ( From => 'user@yahoo.com', To => 'user@yahoo.com', Data => "A simple test message", Subject => "Hello World", ); $msg->send();
Re^2: Sending Mail from Perl Script
by Anonymous Monk on Oct 06, 2008 at 10:22 UTC
    Hi Steve, Thanks. By replacing double codes with single am able to send mails to gmail account.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2024-04-19 08:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found