Sendmail and MX when the mail server is not on the web host

This is a problem that I'm sure is easy to fix, but I hit my head about it all day.

I am developing a new website for a client. The website is located on this website (this is an example). I have a PHP form script to send visitors requests to request@website.com.

When I encoded this on an intermediate server in another domain, everything worked fine. When I moved it to the .com website, the email messages never arrived. The web server is located on a virtual host with the main provider.

Here's what I have learned since then: my client mail server is Microsoft Exchange on a mailbox physically located in the office. Whenever someone from the outside world sends emails to request@website.com, mail arrives. But if the web server sends to the same email address, it fails every time. This is not a PHP problem. I protect the shell on a web server and tested this with both sendmail and the UNIX mail application. I also tested it by emailing various email accounts from the shell. I can send myself an email, for example, only to anyone in the website domain.

In short, when I logged in to the website, the mail to request@website.com, user@website.com, another_user@website.com did not work. All other addresses work fine. What I discovered are those that were emailed, redirected to the mainall account of the web server, where they are in the inbox.

I did an MX search on the website. The MX record points to mailsec.website.com. I can install telnet on the mailsec.website.com 25 port and see the SMTP server.

It seems to me that website.com does not search for MX when sending mail to request@website.com. My theory is that it recognizes the domain as local, sees that there is no user account "requests" to deliver it, and drops the mail to the account. I want to get sendmail to search in MX and send a message to the Exchange server. I'm here. I can’t figure out how to do this.

For that matter, I could step back from here and completely fix it. Internet mail and MX have always seemed to me a black art, and my ignorance undoubtedly manifests itself in this matter.

+2
email smtp sendmail mx-record
Nov 27 '08 at 0:56
source share
6 answers

I think the problem is that sendmail (your process) is talking to the local sendmail daemon. The local sendmail daemon believes that since it is a website, it needs to know how to deliver the email. Unfortunately, the actual address in the field does not exist on the web server, and thus it uploads it to the catchall mailbox. You should talk to your ISP and update their sendmail configuration so that mail addressed to ... @ website.com is sent to the mail exchanger instead of local use.

+8
Nov 27 '08 at 2:28
source share

Sendmail by default guesses the list of local email domains. It can be disabled using the following line in the sendmail.mc file:

define(`confDONT_PROBE_INTERFACES',`True') 

As the root list of local mail domains before and after the change.

 echo '$=w' | sendmail -Am -bt 

You will see which domains should be added β€œmanually” to the (usually) / etc / mail / local-host-names file after disabling automatic guessing.

PS For the sendmail question you can use news: comp.mail.sendmail

+3
Mar 06 '13 at 12:13
source share

tvanfosson basically has it, but as a temporary workaround, you can change your script so that it sends messages to "user@mailsec.website.com" and then the mail is delivered to the actual mail server.

+1
Nov 27 '08 at 3:44
source share

Edit the tsm.cf file (in / etc / mail / or similar) to include

 FEATURE(relay_entire_domain) 

between the lines DOMAIN () and MAILER (). Since you are editing the file, you can also improve security with

 define(`confPRIVACY_FLAGS',``noexpn,novrfy'') 

After modifying the tsm.cf file (or any sendmail configuration file), restart the sendmail or SIGHUP process.

This change is necessary because the WWW and MX servers for the domain do not exist in the same process space; this FEATURE starts sendmail to process messages for the domain using an external delivery mechanism.

The edited part of the tsm.cf file should look something like this:

 DOMAIN(website.com)dnl FEATURE(relay_entire_domain)dnl define(`confPRIVACY_FLAGS',``noexpn,novrfy'')dnl MAILER(smtp)dnl MAILER(procmail)dnl 
0
Apr 01 '09 at 13:41
source share

What worked for me was to add an MX record on the web server that hosts the website, which points to the host assigned to the source domain name server. In the case presented here, there will be an mx entry pointing to: mailsec.website.com

0
Jan 01 2018-10-01T00:
source share

I'm new here. An extension of RB_CWI is required , but I am not allowed to comment. His solution did a great job.

DOMAIN () is not required to define.

However, on my system I had to install the sendmail-cf package.

The instructions below were executed on CentOS 6.5.

Install sendmail-cf first

 sudo yum install sendmail-cf 

Then edit the senmail.mc file

 sudo vi /etc/mail/sendmail.mc 

At the bottom of the file, add FEATURE (relay_entire_domain) dnl so that it looks like this:

 ... FEATURE(relay_entire_domain)dnl MAILER(smtp)dnl # right above this line MAILER(procmail)dnl dnl MAILER(cyrusv2)dnl 

Save the file and restart sendmail.

 sudo service sendmail restart 
0
May 30 '15 at 19:29
source share



All Articles