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

Re^3: Net::SMTP Module query

by karlgoethebier (Parson)
on Nov 12, 2012 at 12:27 UTC ( #1003430=note: print w/replies, xml ) Need Help??


in reply to Re^2: Net::SMTP Module query
in thread Net::SMTP Module query

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»

Replies are listed 'Best First'.
Re^4: Net::SMTP Module query
by gilesy (Initiate) on Nov 12, 2012 at 13:04 UTC
    Hi Karl, I tried your code but the email still isn't being received. Must be a security issue on the server.

      May be but anyway take a look at this:

      #!/usr/bin/perl use MIME::Lite; use strict; use warnings; my $msg = MIME::Lite->new( From => 'someone@somewhere', To => 'someone@nowhere', Subject => 'It is a test', Data => 'I prefere this module.' ); $msg->send('smtp','host', Debug => 1);

      Regards, Karl

      «The Crux of the Biscuit is the Apostrophe»

        Thanks Karl, I've actually included the MIME::Lite module as part of my overall script but wanted to get Net::SMTP working first as this module is already installed on the particular server i'm working on. I have asked for the Mime::Lite module to be installed and am still waiting a good 2 weeks since I originally asked (I don't have access to install this module on the server myself).

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2016-10-01 20:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?






    Results (7 votes). Check out past polls.