0

I have mail relay working properly where my DigOc host (which has many domains on it) is relaying mail through my separate cPanel-based shared hosting plan mail server, logging into a mail account I have there. (This is an easier procedure for me than installing and configuring Postfix.)

All is working fantastic except until I want to send AT&T SMS text messages such as the following:

8431112222@txt.att.net

(I've changed that number, obviously.)

This works if I manually send a mail through Gmail to it from my web browser, but not if I use a PHP script, or Bash script with sendmail mail technique. When I check the mail log, I see the following. Note that I've changed the IP address and the phone number below on purpose.

Jun  8 17:25:39 corp1 sendmail[5826]: u58HPdCP005826: from=root, size=51, class=0, nrcpts=1, msgid=<201606081725.u58HPdCP005826@corp1.104-226-131-166-com>, relay=root@localhost
Jun  8 17:25:39 corp1 sm-mta[5827]: u58HPdKW005827: from=<root@corp1.104-226-131-166-com>, size=314, class=0, nrcpts=1, msgid=<201606081725.u58HPdCP005826@corp1.104-226-131-166-com>, proto=ESMTP, daemon=MTA-v4, relay=corp1.104-226-131-166-com [127.0.0.1]
Jun  8 17:25:39 corp1 sendmail[5826]: u58HPdCP005826: to=8431112222@txt.att.net, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30051, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (u58HPdKW005827 Message accepted for delivery)
Jun  8 17:25:39 corp1 sm-mta[5829]: STARTTLS=client, relay=mx3a.txt.att.net., version=TLSv1/SSLv3, verify=FAIL, cipher=DHE-RSA-AES256-SHA, bits=256/256
Jun  8 17:25:39 corp1 sm-mta[5829]: u58HPdKW005827: to=<8431112222@txt.att.net>, ctladdr=<root@corp1.104-226-131-166-com> (0/0), delay=00:00:00, xdelay=00:00:00, mailer=esmtp, pri=120314, relay=mx3a.txt.att.net. [166.216.149.129], dsn=5.0.0, stat=Service unavailable
Jun  8 17:25:39 corp1 sm-mta[5829]: u58HPdKW005827: u58HPdKW005829: DSN: Service unavailable
Jun  8 17:25:39 corp1 sm-mta[5829]: u58HPdKW005829: to=<root@corp1.104-226-131-166-com>, delay=00:00:00, xdelay=00:00:00, mailer=local, pri=30000, dsn=2.0.0, stat=Sent

I strongly suspect that the problem lies in this line:

Jun  8 17:25:39 corp1 sm-mta[5829]: STARTTLS=client, relay=mx3a.txt.att.net., version=TLSv1/SSLv3, verify=FAIL, cipher=DHE-RSA-AES256-SHA, bits=256/256

Is there anything obvious that I need to do in my Sendmail configuration that might help get this mail message to work?

EDIT

Took @Anderzej advice and did this step. The response I get is:

8431112222@txt.att.net... Connecting to mx3a.txt.att.net. via esmtp...
220 alpemg-mtmta04 bizsmtp ESMTP server ready
>>> EHLO corp1.104-226-131-166-com
250-alpemg-mtmta04 hello [104.226.131.166], pleased to meet you
250-HELP
250-SIZE 1500000
250-ENHANCEDSTATUSCODES
250-8BITMIME
250-STARTTLS
250 OK
>>> STARTTLS
220 2.0.0 Ready to start TLS
>>> EHLO corp1.104-226-131-166-com
250-alpemg-mtmta04 hello [104.226.131.166], pleased to meet you
250-HELP
250-SIZE 1500000
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 OK
>>> MAIL From:<root@corp1.104-226-131-166-com> SIZE=65
554 5.1.0 corp1.104-226-131-166-com  has no MX or A record
/root/dead.letter... Saved message in /root/dead.letter
Closing connection to mx3a.txt.att.net.
>>> QUIT
  • 1
    First fully debug the issue to avoid guesses. serverfault.com/a/746823/163277 – AnFi Jun 8 '16 at 18:04
  • Okay, done. Is something apparent that I can do on my server? Note that I have a domain x.com (changed, obviously) that is where the message is supposed to come from, but sendmail's config is using corp1.104-226-131-166-com. This server services multiple domains for me. So, I can't just change all mail to go out listed as x.com because it needs to service mail for other domains like y.com, z.com, etc. – Volomike Jun 8 '16 at 18:20
2

Thanks to @JennyD, this appears to be the solution:

  1. Turn on debugging on your sendmail test script so that you can get an accurate picture of what the problem is.

  2. Even if relaying through another host, some mail servers do a check back on you. Therefore, you need a valid domain in MASQUERADE_AS() in your /etc/mail/sendmail.mc file, it must be on this same server, and it must respond to a DNS query of A and MX records. That domain doesn't need to be the actual domain you want the From: to say, or even the Reply-To:, but is just the domain that the recipient mail server will check back against.

  3. You'll need to read up on the MASQUERADE_DOMAIN, and then the allmasquerade, masquerade_envelope, and masquerade_entire_domain FEATUREs to see if you need them, and run several tests if you are serving mail for several domains from one host. In my case, I didn't need any of these. Now I can send mail as if it's from x.com, y.com, and z.com all from the same host, and when the AT&T mail server does a check back on what mail server sent it, it will list x.com in my case. However, when the SMS text alert message comes in, I can make it appear as if it's from x.com, y.com, and z.com.

  4. You may also encounter an oddity with AT&T mail servers (and perhaps other mail servers) where you need to add a 5th parameter to your mail() command in PHP. I had to adjust mine as mail($sEmail,'',"HERE IS YOUR ALERT",'','-fuseralerts@x.com'); for the mobile alerts where x.com was the From: address domain that I wanted, and $sEmail is your To: address like 8431112222@txt.att.net. Note no space after the -f parameter.

  • Upvoted for the very first sentence i point 1... it's amazing how many things can be resolved by actually looking at error messages :-) – Jenny D Jun 10 '16 at 9:23
0

The first and main problem is that your sendmail is configured to use a hostname that doesn't exist, within a domain that doesn't exist. There's no domain called "104-226-131-166-com". This means that whenever any script or system function sends out mail without specifying the sender address, it's going to be using an address that doesn't work - which, in turn, means that some systems (like att.net) will reject the mail immediately, others will sort it in the spam bin or silently discard it. And if a recipient system does accept the mail and then is unable to deliver it, you won't get any error message informing you about the problem.

You should change your sendmail config so that the hostname used as a default is the actual hostname of the server.

You should also change your script so that it sets its own sender address to whatever address you want any error messages to come to.

  • Ah, @JennyD, we meet again. (I recall you helping me on Apache configs.) Always a pleasure. Thanks -- I'll give this is a try in a few minutes. – Volomike Jun 8 '16 at 18:28
  • I followed this and this to get the mail to work. However, now all mail goes out as x.com when I may have a domain like y.com and z.com on this server. I have MASQUERADE_AS("x.com")dnl and MASQUERADE_DOMAIN("x.com y.com z.com")dnl. (Obviously doublequotes are changed here b/c of Markdown.) – Volomike Jun 8 '16 at 21:01
  • I fixed it by commenting out MASQUERADE_DOMAIN, FEATURE("allmasquerade")dnl, FEATURE("masquerade_envelope")dnl, and FEATURE("masquerade_entire_domain")dnl and then recompiling the cf file with the m4 command and then restarting the Sendmail service. Evidently all that was necessary was MASQUERADE_DOMAIN must contain only one domain (doesn't matter what it is), and it must be on that same IP and respond to MX and A DNS queries properly. – Volomike Jun 8 '16 at 21:16

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.