I am trying to send a test e-mail with the following Perl script.
use strict;
use warnings;
use MIME::Entity;
my $From = '<valid e-mail address>';
my $To = '<valid e-mail address>';
my $Subject = 'Test';
my $Type = 'text/plain';
my $Host = 'mail.btinternet.com';
my $msg = MIME::Entity->build(
From => $From,
To => $To,
Subject => $Subject,
Type => $Type,
Data => 'This is a test message',
Debug => 1
);
print "\nbefore smtpsend\n\n";
my @ok = $msg->smtpsend(
Host => $Host,
To => $To,
Debug => 1
);
if (@ok) {
print "Sent message to: ", join(', ', @ok), "\n";
}
else {
print "\nFailed to send message";
}
I am fairly sure that something very similar worked on my system some years ago. However, since then I have:
1. started to use Thunderbird as my e-mail application;
2. started to use Virgin Media to give broadband and internet services but I have retained by bt e-mail address.
Using this script I get the following output.
before smtpsend
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(0x25d4468)<<< 220 rgout03.bt.lon5.cpcloud.co.uk ESMTP Service ready)
Net::SMTP=GLOB(0x25d4468)>>> EHLO localhost.localdomain)
Net::SMTP=GLOB(0x25d4468)<<< 250-rgout03.bt.lon5.cpcloud.co.uk)
Net::SMTP=GLOB(0x25d4468)<<< 250-DSN)
Net::SMTP=GLOB(0x25d4468)<<< 250-8BITMIME)
Net::SMTP=GLOB(0x25d4468)<<< 250-PIPELINING)
Net::SMTP=GLOB(0x25d4468)<<< 250-AUTH=LOGIN)
Net::SMTP=GLOB(0x25d4468)<<< 250-AUTH LOGIN PLAIN)
Net::SMTP=GLOB(0x25d4468)<<< 250-DELIVERBY 300)
Net::SMTP=GLOB(0x25d4468)<<< 250 SIZE 41943040)
Net::SMTP=GLOB(0x25d4468)>>> MAIL FROM:<postmaster@hm-insp15>)
Net::SMTP=GLOB(0x25d4468)<<< 553 <postmaster@hm-insp15> Invalid mail address, must be fully qualified domain)
Net::SMTP=GLOB(0x25d4468)>>> QUIT)
Net::SMTP=GLOB(0x25d4468)<<< 221 rgout03.bt.lon5.cpcloud.co.uk QUIT)
Failed to send message
It seems that postmaster@hm-insp15 is not correct. What can I do to correct this?