Hi freinds
I have a small problem I want u to help me in, I have a syslog server and configured it to send me email automatically, I get a small perl script to help me in, and tested it to send alerts to root and it worked successfully without any problems
Now I want to send it outside, I configured my sendmail to use my email server as SMARTHOST , and tested it by sending email like the following and it delevered successfuly
mail -s test reaky@domain.com -- -r reaky@server.com
Now I tried to use my perl script to use to out side reaky@domain.com, but It doesn't work, the perl script using sendmail -t instead of mail, So what I want to do is modifying this script to use the command: mail -s test reaky@domain.com -- -r reaky@server.com when sending the message
the following is the perl script:
#!/usr/bin/perl -n
# thanks to Brian Dowling for an example with security in mind.
$TO = 'bassam@tedata.net';
$FROM = $TO;
s/^<\d{1,2}>//;
open(MAIL, "|/usr/sbin/sendmail -t");
print MAIL <<"EOT";
To: $TO
From: $FROM
Subject: SME Log Alert: $_
$_
EOT
close(MAIL);
Thanks for help
---------- Post updated at 02:50 AM ---------- Previous update was at 02:31 AM ----------
I would prefer you keep the sendmail program in the script, and instead configure "submit.cf" with your SMARTHOST. You probably configured only "sendmail.cf", but there's very little reason for your server to be handling incoming mail.
I think I know the problem now but I don't know how to solve it
the problem that the sendmail command still using root@localhost.localdomain when sending, Which is rejected
Look to the delevery failier:
The original message was received at Mon, 6 Jul 2009 11:16:03 +0300
from blackreaper [127.0.0.1]
----- The following addresses had permanent fatal errors -----
<reaky@domain.com>
(reason: 554 mailfrom without country or top level domain is administratively denied)
----- Transcript of session follows -----
... while talking to out.tedata.net.eg.:
>>> MAIL From:<root@localhost.localdomain>
<<< 554 mailfrom without country or top level domain is administratively denied
554 5.0.0 Service unavailable
Finally I found the problem
The Local_Domain option in sendmail.mc have to be modified , ad it always try to send using it, I changed it and It works now with the same script
Thanks