Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No recipient addresses found in header - Sendmail

Tags:

perl

sendmail

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);
like image 215
U Swaroop Avatar asked Oct 20 '25 16:10

U Swaroop


1 Answers

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);
like image 166
AnFi Avatar answered Oct 23 '25 11:10

AnFi