I also tryed to send email like this way
#!"C:\xampp\perl\bin\perl.exe"
$to = 'alexjaquet@gmail.com';
$from = 'robot@company.com';
$subject = 'Party!!!';
$message = 'Details of party';
open(MAIL, "c:/xampp/sendmail/sendmail.exe -t");
# Email Header
print MAIL "To: $to\n";
print MAIL "From: $from\n";
print MAIL "Subject: $subject\n\n";
# Email Body
print MAIL $message;
close(MAIL);
print "Content-Type: text/html\n\n";
print "Email Sent Successfully\n";
print "Send email from windows 10 ok";
it print the message without any errors but no mail is sended
I'm still investigating solutions to fix my problem, here is a new script I found
#!"C:\xampp\perl\bin\perl.exe"
use strict;
use warnings;
use Email::Sender::Simple qw(sendmail);
use Email::Sender::Transport::SMTPS ();
use Email::Simple ();
use Email::Simple::Creator ();
my $smtpserver = 'localhost';
my $smtpport = 587;
my $smtpuser = 'robot@localhost.localdomain';
my $smtppassword = 'test';
my $transport = Email::Sender::Transport::SMTPS->new({
host => $smtpserver,
port => $smtpport,
ssl => "starttls",
sasl_username => $smtpuser,
sasl_password => $smtppassword,
});
my $email = Email::Simple->create(
header => [
To => 'alexjaquet@gmail.com',
From => 'robot@avant-garde.no-ip.biz',
Subject => 'Hi!',
],
body => "This is my message\n",
);
sendmail($email, { transport => $transport });
this script give me the Following error
[Sun Jun 30 15:15:31.745191 2019] [cgi:error] [pid 6624:tid 1868] [cli
+ent ::1:64916] End of script output before headers: mail4.pl
[Sun Jun 30 15:15:31.745191 2019] [cgi:error] [pid 6624:tid 1868] [cli
+ent ::1:64916] AH01215: unable to establish SMTP connection\r: C:/xam
+pp/cgi-bin/mail4.pl
[Sun Jun 30 15:15:31.745191 2019] [cgi:error] [pid 6624:tid 1868] [cli
+ent ::1:64916] AH01215: \r: C:/xampp/cgi-bin/mail4.pl
[Sun Jun 30 15:15:31.745191 2019] [cgi:error] [pid 6624:tid 1868] [cli
+ent ::1:64916] AH01215: Trace begun at C:\\xampp\\perl\\site\\lib\\Em
+ail\\Sender\\Transport\\SMTPS.pm line 98\r: C:/xampp/cgi-bin/mail4.pl
[Sun Jun 30 15:15:31.745707 2019] [cgi:error] [pid 6624:tid 1868] [cli
+ent ::1:64916] AH01215: Email::Sender::Transport::SMTPS::_throw('Emai
+l::Sender::Transport::SMTPS=HASH(0x3b72f08)', 'unable to establish SM
+TP connection') called at C:\\xampp\\perl\\site\\lib\\Email\\Sender\\
+Transport\\SMTPS.pm line 60\r: C:/xampp/cgi-bin/mail4.pl
[Sun Jun 30 15:15:31.746205 2019] [cgi:error] [pid 6624:tid 1868] [cli
+ent ::1:64916] AH01215: Email::Sender::Transport::SMTPS::_smtp_client
+('Email::Sender::Transport::SMTPS=HASH(0x3b72f08)') called at C:\\xam
+pp\\perl\\site\\lib\\Email\\Sender\\Transport\\SMTPS.pm line 107\r: C
+:/xampp/cgi-bin/mail4.pl
[Sun Jun 30 15:15:31.746726 2019] [cgi:error] [pid 6624:tid 1868] [cli
+ent ::1:64916] AH01215: Email::Sender::Transport::SMTPS::send_email('
+Email::Sender::Transport::SMTPS=HASH(0x3b72f08)', 'Email::Abstract=AR
+RAY(0x1189a18)', 'HASH(0x27d4440)') called at C:\\xampp\\perl\\vendor
+\\lib\\Email\\Sender\\Role\\CommonSending.pm line 45\r: C:/xampp/cgi-
+bin/mail4.pl
[Sun Jun 30 15:15:31.746726 2019] [cgi:error] [pid 6624:tid 1868] [cli
+ent ::1:64916] AH01215: Email::Sender::Role::CommonSending::try {...}
+ at C:\\xampp\\perl\\vendor\\lib\\Try\\Tiny.pm line 102\r: C:/xampp/
+cgi-bin/mail4.pl
[Sun Jun 30 15:15:31.746726 2019] [cgi:error] [pid 6624:tid 1868] [cli
+ent ::1:64916] AH01215: eval {...} at C:\\xampp\\perl\\vendor\\lib\\T
+ry\\Tiny.pm line 93\r: C:/xampp/cgi-bin/mail4.pl
[Sun Jun 30 15:15:31.747195 2019] [cgi:error] [pid 6624:tid 1868] [cli
+ent ::1:64916] AH01215: Try::Tiny::try('CODE(0x446b5a8)', 'Try::Tiny:
+:Catch=REF(0x3b72a58)') called at C:\\xampp\\perl\\vendor\\lib\\Email
+\\Sender\\Role\\CommonSending.pm line 58\r: C:/xampp/cgi-bin/mail4.pl
[Sun Jun 30 15:15:31.747195 2019] [cgi:error] [pid 6624:tid 1868] [cli
+ent ::1:64916] AH01215: Email::Sender::Role::CommonSending::send('Ema
+il::Sender::Transport::SMTPS=HASH(0x3b72f08)', 'Email::Abstract=ARRAY
+(0x1189a18)', 'HASH(0x44659c8)') called at C:\\xampp\\perl\\vendor\\l
+ib\\Email\\Sender\\Simple.pm line 119\r: C:/xampp/cgi-bin/mail4.pl
[Sun Jun 30 15:15:31.747691 2019] [cgi:error] [pid 6624:tid 1868] [cli
+ent ::1:64916] AH01215: Email::Sender::Simple::send_email('Email::Sen
+der::Simple', 'Email::Abstract=ARRAY(0x1189a18)', 'HASH(0x3b697c8)')
+called at C:\\xampp\\perl\\vendor\\lib\\Email\\Sender\\Role\\CommonSe
+nding.pm line 45\r: C:/xampp/cgi-bin/mail4.pl
[Sun Jun 30 15:15:31.747691 2019] [cgi:error] [pid 6624:tid 1868] [cli
+ent ::1:64916] AH01215: Email::Sender::Role::CommonSending::try {...}
+ at C:\\xampp\\perl\\vendor\\lib\\Try\\Tiny.pm line 102\r: C:/xampp/
+cgi-bin/mail4.pl
[Sun Jun 30 15:15:31.747691 2019] [cgi:error] [pid 6624:tid 1868] [cli
+ent ::1:64916] AH01215: eval {...} at C:\\xampp\\perl\\vendor\\lib\\T
+ry\\Tiny.pm line 93\r: C:/xampp/cgi-bin/mail4.pl
[Sun Jun 30 15:15:31.748205 2019] [cgi:error] [pid 6624:tid 1868] [cli
+ent ::1:64916] AH01215: Try::Tiny::try('CODE(0x27d4788)', 'Try::Tiny:
+:Catch=REF(0x3b57420)') called at C:\\xampp\\perl\\vendor\\lib\\Email
+\\Sender\\Role\\CommonSending.pm line 58\r: C:/xampp/cgi-bin/mail4.pl
[Sun Jun 30 15:15:31.748683 2019] [cgi:error] [pid 6624:tid 1868] [cli
+ent ::1:64916] AH01215: Email::Sender::Role::CommonSending::send('Ema
+il::Sender::Simple', 'Email::Simple=HASH(0x27d46c8)', 'HASH(0x27d4200
+)') called at C:\\xampp\\perl\\vendor\\lib\\Sub\\Exporter\\Util.pm li
+ne 18\r: C:/xampp/cgi-bin/mail4.pl
[Sun Jun 30 15:15:31.748683 2019] [cgi:error] [pid 6624:tid 1868] [cli
+ent ::1:64916] AH01215: Sub::Exporter::Util::__ANON__('Email::Simple=
+HASH(0x27d46c8)', 'HASH(0x27d4200)') called at C:\\xampp\\cgi-bin\\ma
+il4.pl line 32\r: C:/xampp/cgi-bin/mail4.pl
My hMailServer hostname is localhost and run within the port 587 |