Hi I have the following code:
my @body = "TEST MESSAGE";
chomp( @body ) ;
my $from = 'admin@mydomain.com' ;
my $to = 'myname@mydomain.com' ;
my $subject = "Test";
my $xml = "<mailer expand='no'><from><email>$from</email></from><to><email>$to</email></to><subject>$subject</subject>"
. "<message><![CDATA[" . join( "\n" , @body ) . "]]></message><attachments/></mailer>" ;
my $mailer = "/usr/local/bin/iwperl $iwhome/local/mailer/mailer.ipl" ;
open OUT , "|" . $mailer ;
print OUT $xml ;
close OUT ;
When I run this program from the command line it is sending the email. But when I put it in a subroutine in a application then it is unable to send the email and gives the following error message:
The e-mail system was unable to deliver the message, but did not report a specific reason. Check the address and try again. If it still fails, contact your system administrator.
< nsmtrs2.mydomain.com #5.0.0 X-Postfix; host mailhost.mydomain.com[3.10.333.12] said: 550 Error: Message content rejected>
I am calling the code like this in the application.
&sendmail( @email_body );
sub sendmail
{
my @body = @_ ;
chomp( @body ) ;
my $from = 'admin@mydomain.com' ;
my $to = 'myname@mydomain.com' ;
my $subject = "Test";
my $xml = "<mailer expand='no'><from><email>$from</email></from><to><email>$to</email></to><subject>$subject</subject>"
. "<message><![CDATA[" . join( "\n" , @body ) . "]]></message><attachments/></mailer>" ;
my $mailer = "$/usr/local/bin/iwperl $iwhome/local/mailer/mailer.ipl" ;
open OUT , "|" . $mailer ;
print OUT $xml ;
close OUT ;
}
my @body = "TEST MESSAGE";
chomp( @body ) ;
my $from = 'admin@mydomain.com' ;
my $to = 'myname@mydomain.com' ;
my $subject = "Test";
my $xml = "<mailer expand='no'><from><email>$from</email></from><to><email>$to</email></to><subject>$subject</subject>"
. "<message><![CDATA[" . join( "\n" , @body ) . "]]></message><attachments/></mailer>" ;
my $mailer = "/usr/local/bin/iwperl $iwhome/local/mailer/mailer.ipl" ;
open OUT , "|" . $mailer ;
print OUT $xml ;
close OUT ;
When I run this program from the command line it is sending the email. But when I put it in a subroutine in a application then it is unable to send the email and gives the following error message:
The e-mail system was unable to deliver the message, but did not report a specific reason. Check the address and try again. If it still fails, contact your system administrator.
< nsmtrs2.mydomain.com #5.0.0 X-Postfix; host mailhost.mydomain.com[3.10.333.12] said: 550 Error: Message content rejected>
I am calling the code like this in the application.
&sendmail( @email_body );
sub sendmail
{
my @body = @_ ;
chomp( @body ) ;
my $from = 'admin@mydomain.com' ;
my $to = 'myname@mydomain.com' ;
my $subject = "Test";
my $xml = "<mailer expand='no'><from><email>$from</email></from><to><email>$to</email></to><subject>$subject</subject>"
. "<message><![CDATA[" . join( "\n" , @body ) . "]]></message><attachments/></mailer>" ;
my $mailer = "$/usr/local/bin/iwperl $iwhome/local/mailer/mailer.ipl" ;
open OUT , "|" . $mailer ;
print OUT $xml ;
close OUT ;
}