in reply to Re^2: e-mail fails with address that is not a fully qualified domain
in thread e-mail fails with address that is not a fully qualified domain

MailFrom option is to the smtpsend.

  • Comment on Re^3: e-mail fails with address that is not a fully qualified domain

Replies are listed 'Best First'.
Re^4: e-mail fails with address that is not a fully qualified domain
by merrymonk (Hermit) on Jun 01, 2015 at 21:24 UTC
    I made the change so that MailFrom is in smtpsend.
    my @ok = $msg->smtpsend( Host => $full_host_name, MailFrom => $From, To => $To, Debug => 1 );

    This did give a different set of debug messages as shown below.
    I visited the bt site and found that I should enable SMTP authentication in my e-mail program.
    I assumed that this meant my e-mail application which is Thunderbird 31.7.0. However, in spite of searching in Thunderbird and web sites I could not find out to do this.
    Can anyone help?

    Net::SMTP>>> Net::SMTP(2.31)
    Net::SMTP>>> Net::Cmd(2.29)
    Net::SMTP>>> Exporter(5.68)
    Net::SMTP>>> IO::Socket::INET(1.33)
    Net::SMTP>>> IO::Socket(1.37)
    Net::SMTP>>> IO::Handle(1.34)
    Net::SMTP=GLOB(0x27644f8)<<< 220 rgout05.bt.lon5.cpcloud.co.uk ESMTP Service ready
    Net::SMTP=GLOB(0x27644f8)>>> EHLO localhost.localdomain
    Net::SMTP=GLOB(0x27644f8)<<< 250-rgout05.bt.lon5.cpcloud.co.uk
    Net::SMTP=GLOB(0x27644f8)<<< 250-DSN
    Net::SMTP=GLOB(0x27644f8)<<< 250-8BITMIME
    Net::SMTP=GLOB(0x27644f8)<<< 250-PIPELINING
    Net::SMTP=GLOB(0x27644f8)<<< 250-AUTH=LOGIN
    Net::SMTP=GLOB(0x27644f8)<<< 250-AUTH LOGIN PLAIN
    Net::SMTP=GLOB(0x27644f8)<<< 250-DELIVERBY 300
    Net::SMTP=GLOB(0x27644f8)<<< 250 SIZE 41943040
    Net::SMTP=GLOB(0x27644f8)>>> MAIL FROM:<valid e-mail address>
    Net::SMTP=GLOB(0x27644f8)<<< 530 authentication required - Your email could not be sent. To fix this you must make a simple change to your email clien t (known as SMTP authentication). For advice visit http://www.bt.com/smtp
    Net::SMTP=GLOB(0x27644f8)>>> QUIT

      You are writing an email program. The email program in which you need to enable authentication is the one you're writing. Look into the auth() method of Net::SMTP.

        I have now tried using Net::SMTP but only with partial success.
        Below is the Perl scritp and the output that I get.
        I understand from the output that all should be OK. However the e-mail is not arriving at it to address. I have tried a number of to addresses and even looked in the spam folder when I sent it to myself.
        I used the following web sites for help
        http://search.cpan.org/~shay/libnet-3.06/lib/Net/SMTP.pm
        http://quark.humbug.org.au/publications/perl/perlsmtpintro.html

        Can anyone suggest how I can make these e-mails actually arrive and/or find out what is happening to them?
        # test e-mail june 2015 use strict; use warnings; use Net::SMTP; use Authen::SASL; my ($host_em, $to_em, $cc_em, $from_em, $subj_em, $data_em, %attach_em +, $res_em, $err_em, $smtp); my ($full_host_name, $password_em, $username); my ($banner, $domain); $host_em = 'mail.btinternet.com'; $full_host_name = (gethostbyname $host_em)[0]; print "full_host_name <$full_host_name>\n"; $from_em = 'valid e-mail address'; $cc_em = 'valid e-mail address'; $to_em = 'valid e-mail address'; $password_em = 'password for $from_em'; $subj_em = 'Test e-mail'; $data_em = 'Please let me know if this arrives'; $smtp = Net::SMTP->new($host_em, Debug => 1); print "\nsmtp <$smtp>\n"; $smtp->auth ($from_em, $password_em); print "\nbefore ->mail\n"; $smtp->mail ($from_em); print "\nbefore ->to\n"; $smtp->to($to_em); print "\nbefore ->data\n"; $smtp->data; $smtp->datasend("From: " . $from_em); $smtp->datasend("To: " . $to_em); $smtp->datasend('Subject: This is a test'); $smtp->datasend("\n"); $smtp->datasend("$data_em"); $smtp->dataend; $smtp->quit; $banner = $smtp->banner; print "\nbanner <$banner>\n"; $domain = $smtp->domain; print "\ndomain <$domain>\n";


        full_host_name <mail.btinternet.bt.lon5.cpcloud.co.uk>
        Net::SMTP>>> Net::SMTP(2.31)
        Net::SMTP>>> Net::Cmd(2.29)
        Net::SMTP>>> Exporter(5.64_01)
        Net::SMTP>>> IO::Socket::INET(1.31)
        Net::SMTP>>> IO::Socket(1.31)
        Net::SMTP>>> IO::Handle(1.28)
        Net::SMTP=GLOB(0x183e988)<<< 220 rgout02.bt.lon5.cpcloud.co.uk ESMTP Service ready
        Net::SMTP=GLOB(0x183e988)>>> EHLO localhost.localdomain
        Net::SMTP=GLOB(0x183e988)<<< 250-rgout02.bt.lon5.cpcloud.co. uk
        Net::SMTP=GLOB(0x183e988)<<< 250-DSN
        Net::SMTP=GLOB(0x183e988)<<< 250-8BITMIM
        E Net::SMTP=GLOB(0x183e988)<<< 250-PIPELINING
        Net::SMTP=GLOB(0x183e988)<<< 250-AUTH=LOGIN
        Net::SMTP=GLOB(0x183e988)<<< 250-AUTH LOGIN PLAIN
        Net::SMTP=GLOB(0x183e988)<<< 250-DELIVERBY 300
        Net::SMTP=GLOB(0x183e988)<<< 250 SIZE 41943040
        smtp <Net::SMTP=GLOB(0x183e988)>
        Net::SMTP=GLOB(0x183e988)>>> AUTH LOGIN
        Net::SMTP=GLOB(0x183e988)<<< 334 VXNlcm5hbWU6
        Net::SMTP=GLOB(0x183e988)>>> aGVucnkubWVycnl3ZWF0aGVyQGJ0aW50ZXJuZXQuY29t
        Net::SMTP=GLOB(0x183e988)<<< 334 UGFzc3dvcmQ6
        Net::SMTP=GLOB(0x183e988)>>> Z2VvMTkwMWxlYWNoYQ==
        Net::SMTP=GLOB(0x183e988)<<< 235 LOGIN authentication successful
        before ->mail
        Net::SMTP=GLOB(0x183e988)>>> MAIL FROM:<$from_em>
        Net::SMTP=GLOB(0x183e988)<<< 250 MAIL FROM:<$from_em> OK before ->to Net::SMTP=GLOB(0x183e988)>>> RCPT TO:<$to_em> Net::SMTP=GLOB(0x183e988)<<< 250 RCPT TO:<$to_em> OK before ->data
        Net::SMTP=GLOB(0x183e988)>>> DATA
        Net::SMTP=GLOB(0x183e988)<<< 354 Start mail input; end with <CRLF>.<CRLF>
        Net::SMTP=GLOB(0x183e988)>>> From: $from_em
        Net::SMTP=GLOB(0x183e988)>>> To: $to_em
        Net::SMTP=GLOB(0x183e988)>>> Subject: This is a test
        Net::SMTP=GLOB(0x183e988)>>> Please let me know if this arrives
        Net::SMTP=GLOB(0x183e988)>>> .
        Net::SMTP=GLOB(0x183e988)<<< 250 <556D7AAA00016CE0> Mail accepted
        Net::SMTP=GLOB(0x183e988)>>> QUIT
        Net::SMTP=GLOB(0x183e988)<<< 221 rgout02.bt.lon5.cpcloud.co.uk QUIT

        banner <rgout02.bt.lon5.cpcloud.co.uk ESMTP Service ready
        >
        domain <rgout02.bt.lon5.cpcloud.co.uk>