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

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.

Replies are listed 'Best First'.
Re^3: Net::SMTP Module query
by karlgoethebier (Abbot) on Nov 12, 2012 at 12:27 UTC

    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.

        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»