Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Net::SMTP Module query

by karlgoethebier (Curate)
on Nov 12, 2012 at 11:54 UTC ( #1003426=note: print w/ replies, xml ) Need Help??


in reply to Net::SMTP Module query

perl -c mail.pl Possible unintended interpolation of @address in string at mail.pl lin +e 11. Possible unintended interpolation of @address in string at mail.pl lin +e 12. Global symbol "@address" requires explicit package name at mail.pl lin +e 11. Global symbol "@address" requires explicit package name at mail.pl lin +e 12.
my $MailFrom = "from\@address.com"; my $MailTo = "gilesy\@address.com";

Try this. Didn't check the rest. Regards, Karl

«The Crux of the Biscuit is the Apostrophe»


Comment on Re: Net::SMTP Module query
Select or Download Code
Re^2: Net::SMTP Module query
by gilesy (Initiate) on Nov 12, 2012 at 12:06 UTC
    Hi Karl, Thanks for the swift reply. I actually edited my code when posting to this site and do have that code in my script
    my $MailFrom = "from\@address.com"; my $MailTo = "gilesy\@address.com";
    ..... but the email isn't being sent. I'm getting the output I displayed in original post.

      Update:

      Sorry, the first line was wrong for you. But i think you noted this.

      #!/usr/bin/perl use Net::SMTP; use strict; use warnings; print "Content-type: text/html\n\n"; my $MailHost = "mailhost"; my $MailFrom = "someone\@somewhere"; my $MailTo = "someone\@somewhere"; my $subject = "Super!\n"; my $MailBody = "It works!\n"; my $smtp = Net::SMTP->new($MailHost) || die $!; $smtp->mail($MailFrom); $smtp->to($MailTo); $smtp->data(); $smtp->datasend("To: $MailTo\n"); $smtp->datasend("From: $MailFrom\n"); $smtp->datasend("Subject: $subject\n"); $smtp->datasend("\n"); $smtp->datasend("$MailBody\n\n"); $smtp->dataend(); $smtp->quit;

      Please try this. Regards, Karl

      «The Crux of the Biscuit is the Apostrophe»

        Hi Karl, I tried your code but the email still isn't being received. Must be a security issue on the server.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (13)
As of 2014-10-21 10:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (100 votes), past polls