0

On my Redhat Prod Server I installed Sendmail that I will use to send DB Backup completion mails to my email id.

When I send a email from My Server A 172.16.233.2 to my email id abc@domain.com. using

sendmail -v myemailid@domain.com < /opt/dailydbscriptoutput.txt

myemailid@domain.com... Connecting to [127.0.0.1] via relay...
220 db.erp.com ESMTP Sendmail 8.13.8/8.13.8; Thu, 7 Aug 2014 13:37:17 +0300
>>> EHLO pmmcdb.erp.com
250-db.erp.com Hello localhost.localdomain [127.0.0.1], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-DELIVERBY
250 HELP
>>> MAIL From:<emerg@db.erp.com> SIZE=59
250 2.1.0 <emerg@db.erp.com>... Sender ok
>>> RCPT To:<myemailid@domain.com>
>>> DATA
250 2.1.5 <myemailid@domain.com>... Recipient ok
354 Enter mail, end with "." on a line by itself
>>> .
250 2.0.0 s77AbH2H025298 Message accepted for delivery
myemailid@domain.com... Sent (s77AbH2H025298 Message accepted for delivery)
Closing connection to [127.0.0.1]
>>> QUIT
221 2.0.0 db.erp.com closing connection

I get the above message. But when I check the Log /var/log/maillog. I See this

Aug  7 12:18:41db sendmail[11808]: s779If28011808: from=emerg, size=59, class=0, nrcpts=1, msgid=<201408070918.s779If28011808@db.erp.com>, relay=emerg@localhost
Aug  7 12:18:41 db sendmail[11809]: s779Ifss011809: from=<emerg@db.erp.com>, size=342, class=0, nrcpts=1, msgid=<201408070918.s779If28011808@db.erp.com>, proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]
Aug  7 12:18:41 db sendmail[11808]: s779If28011808: to=myemailid@domain.com, ctladdr=emerg (503/503), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30059, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (s779Ifss011809 Message accepted for delivery)
Aug  7 12:18:42 db sendmail[11811]: s779Ifss011809: to=<myemailid@domain.com>, ctladdr=<emerg@db.erp.com> (503/503), delay=00:00:01, xdelay=00:00:01, mailer=relay, pri=120342, relay=mail1 [10.171.1.10], **dsn=5.6.0, stat=Data format error**

Previously I was facing issue on server related to DNS.

Name server timeout

So I followed this Link Setup Sendmail without DNS to solve the issue and on another Test server it started working and then I applied the same procedure on this Production server and im not able to send messages

After Testing

sendmail -Am -v myemailid@domain.com  < /tmp/email.txt
myemailid@domain.com... Connecting to mail1 via relay...
220 mail1.etradeportal.net ESMTP Sendmail 8.13.1/8.13.1; Thu, 7 Aug 2014 15:18:51 +0300
>>> EHLO db.erp.com
250-mail1.etradeportal.net Hello [172.16.233.2], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-AUTH DIGEST-MD5 CRAM-MD5
250-DELIVERBY
250 HELP
>>> MAIL From:<root@db.erp.com> SIZE=108
553 5.1.8 <root@db.erp.com>... Domain of sender address root@db.erp.com does not exist
/root/dead.letter... Saved message in /root/dead.letter
Closing connection to mail1
>>> QUIT
221 2.0.0 mail1.etradeportal.net closing connection
1

Try the script below:

#!/bin/sh
FILE=/opt/dailydbscriptoutput.txt 
TO=myemailid@domain.com 

(cat - $FILE <<END) | /usr/sbin/sendmail -i $TO
TO: $TO

END

Sendmail expects headers and body separated by an empty line in "raw" format.

To get better debug info execute the above script as root with -Am -v command line options passed to sendmail.


Fixing Domain of sender address root@db.erp.com does not exist

On the receiving host add db.erp.com entry to /etc/hosts file [db.erp.com uses private/"non public"/"intranet only" IP address]

  • I added the Debug of "sudo myemailid@domain.com < /tmp/email.txt" its throwing Domain of Sender Address not found. – OmiPenguin Aug 7 '14 at 12:42
  • I added the entry on receiving Server's /etc/hosts file. But still same issue. Although another server is working with same conig but I didnt mention that server's IP or hostname on receiving server's Hosts file still that server is working. But this Prod server is not working even with same configs – OmiPenguin Aug 11 '14 at 9:23
  • Ok I fixed the issue. I used the complete IP, FQDN and SHORTNAME of DB Server and insert in the Mail Relay Server's host file and vice versa and this damn thing start working. – OmiPenguin Aug 12 '14 at 12:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.