I am using the below code.
I have printed my $to
variable and it is fine. I am still getting error
No recipient addresses found in header
my $sendmail = "/usr/sbin/sendmail -t";
my $reply_to = "Reply-to: swa.udda\@lkl.com";;
my $subject = $lSubjectLine;
my $content = $lMessage;
my $to = "To: ".$lEmailAdd;
my $file = $l_finalFile;
my $from = "From: test.a\@lkl.com";
open( SENDMAIL, "|$sendmail" ) or die "Cannot open $sendmail: $!";
print SENDMAIL <<EOM;
$reply_to
$subject
$from
$to
$content
EOM
close(SENDMAIL);
The script you provided (as you provided it) generates empty line (end of headers mark) after Reply-To:
header.
Modify you script to inspect message you pass to sendmail.
my $sendmail = "/usr/sbin/sendmail -t -i";
my $MSG=<<EOM;
...
EOM
print $MSG; # print message to STDOUT for inspection
open( SENDMAIL, "|$sendmail" ) or die "Cannot open $sendmail: $!";
print SENDMAIL $MSG;
close(SENDMAIL);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With