Email issue with DNS and (maybe) PHP mail() - php

On my client's website (domain.com) we have a contact form which sends an email to the client an me (client#domain.com and me#gmail.com).
The email is sent using PHP mail() function.
The website is hosted on my web server (MediaTemple DV) but the client has it's own server where Exchange is running (IP: xx.xxx.xx.xx, DOMAIN: server.com). Since the emails are handled by his server, I had to modify the DNS records on domain.com.
A: mail.domain.com -> xx.xxx.xx.xx
MX: (0) domain.com -> mail.domain.com
MX: (10) domain.com -> mail.server.com
When I use the contact form, I don't get any PHP error but only me#gmail.com receives the message.
After a few minutes, qmail (MediaTemple mail system) sends me an error email saying that client#domain.com "no longer accepts mail".
What's weird is that when I send an email to client#domain.com FROM gmail.com, then he gets it. Note that the client can still send email from Outlook with no problem.
Also note that all my other emails on other domains on my MediaTemple server work fine.
Does anyone have an idea why it behaves like this?
Thanks!

Make sure the mail service for the domain is turned off on the (dv) - it's trying to deliver locally and not even checking the DNS. That should immediately solve the problem.
(Also, probably a question for ServerFault?)

Related

Getting my web server to send an email on behalf of my mail server

So, I have a separate web server and mail server configured for the same domain (web.example.com & mail.example.com, each with different IPs). The reason I did this was so that I could use CloudFlare to deliver my web content while protecting my origin IP. I understand that my mail server's IP is exposed, this is alright for the time being.
The issue I am facing is that if an email originates from my web server (let's say for instance a user forgets their login details, and my web server triggers a recovery email to be sent)... this will expose my web server's origin IP in the headers of the email sent to the user.
What I need to be able to do, is either one of the following, I am also open to other suggestions:
1) Masquerade as the IP of web.example.com
2) Trigger an email to be sent from mail.example.com
Both servers have PostFix and Dovecot configured.
I am using PHP to trigger mails to be sent.

Record/copies of PHP mail() previously sent from our website?

Should there be a record of all php sent mail (via our hosts mail() function) anywhere?
Our web developer made an oversight and all enquiries sent via the our host's (godaddy.com) mailer relay for the last 2 months were rejected by our local mail server. Naturally, our server doesn't keep any rejected emails.
I have spoken to godaddy.com and they claim there is no record, however I'm not particularly confident with the answer.
Is there anything I can do? The enquiry form is now fixed (used Mandrill), so that's not an issue.
No, the mails are gone now.
Rejected mails that a mail server tried to send usually go to the mail admin account of the sending server as a bounce - however, even that account might not be set up or failing or rejecting mail, so the mail server will get rid of these undeliverable mails that double-bounced by deleting them from the queue.
You might get an idea of what was tried to mail if you are able to get your hand onto a mail server logfile, but assuming this is in the hands of your hosting provider, your chances are low: 1. these logs would only give you an idea of which mail addresses were involved, but no content. 2. the log files usually get deleted quickly because they'd serve no regular purpose.

php website mail form not getting to exchange server recipient -

I picked this script because it had a CAPTCHA and file upload/attachment. http://www.html-form-guide.com/contact-form/php-contact-form-tutorial.html/comment-page-2#comments
I know it is older, and the script writer isn't support it on their website.
The form is at HostGator at web address (fake of course, just using it for example) "abcinc.com". The company/website owner has their emails on an Exchange Server 2013 and is using "abc.com" for their mail.
The email the form creates - I receive it at my Google/Gmail accounts. I've used this script on this server for half dozen other people (different website organizations) who receive them fine (either using the Google/Gmail, Hostgator mail).
This client can not receive these emails on their Exchange Server (2013) at "abc.com" (and yes, I have the email addresses in the form correctly).
I'm just trying to learn something. That is why I'm here. I'm not a php programmer, I'm not a cPanel, Exchange Server or any kind of mail / server demi-god. All I know is I picked a script and modified it, hosted it at HostGator, and believed that when the form was used that HostGator sent the mail to whom evers email addresses are in the form.
The Exchange tech support people wrote me this:
I need to know the SMTP service you are using to send the email and if
it is possible for you to use a real email address from ABC.com to
send the email from the form.
Please take a look at the article below and try to mirror the settings
as best you can. Also, please us an actual email address from
abcinc.com to send the email if possible. I can create a new one for
you or you can use an existing one if you like. After you have made
these changes or if you have any questions, please reach out to me so
we can do final testing.
Here is a KB that has all the settings typically used for web
applications and other devices to be able to send using our servers.
If there web application is doing the sending portion, please see if
there are any logs available that may show
How To Configure Your Printer, Scanner, Copier, Web Script Or SMTP Application To Work With An Exchange Account
http://hosting.intermedia.net/support/kb/viewKBArticle.asp?id=2167
Here are the specific settings for your account. Note: this is an
Exchange 2013 server.
(I didn't include the settings here)
So after attempting to read through that my brain exploded. When I recovered I logged on with HostGator support to ask them... hell I don't know what I was trying to ask them.
They told me to give them my cPanel IP.
I then asked the Exchange Server people if they could just give me a script they knew worked. Yeah... I did. :-\
So my question is - what is keeping this Exchange Server from receiving these emails?
Mostly so I can become ever so slightly more educated than I was 10 minutes ago.
~Kaye
PS / EDITED
I came back to add, I just tried another (basic) form and they received it.
From the form that was not getting to the Exchange Server, this is the header info:
To: jill#abc.com
Subject: Contact form submission from Kaye
X-PHP-Script: www.abcinc.com/estimates.php for 76.3.118.189
Date: Fri, 13 Sep 2013 15:37:30 -0500
From: Kaye <nobody#www.abc.com>
Reply-To: kaye#mydomain.com
Message-ID: <be82ada010a752b86440e86e5c24ca0a#www.abcinc.com>
X-Priority: 3
X-Mailer: PHPMailer (phpmailer.sourceforge.net) [version 2.0.4]
MIME-Version: 1.0
Content-Type: multipart/alternative;
In the form that did work, it is using the actual email that the user enters into the form as the FROM email address - not the server. Is this what could be the issue the Exchange Server is having?
function GetFromAddress()
{
if(!empty($this->from_address))
{
return $this->from_address;
}
$host = $_SERVER['SERVER_NAME'];
$from ="nobody#$host";
return $from;
}
Most hosted Exchange providers include filters that will check for SPF records—or MX records at a minimum—for the domain with which the sender address is associated. Since there is most likely neither an SPF nor a MX record for www.[your-domain].com (because of the "www."), the hosted Exchange provider's SPAM blocker is marking the message as SPAM because it cannot verify that the IP address from which the message is coming is actually, legitimately associated with www.[your-domain].com—or, alternately (and perhaps more likely), that www.[your-domain].com has no MX or SPF records associated with it and thus the server assumes the message must be junk (because why would a domain name not configured for email be sending email?). [your-domain].com might have those records, but that doesn't necessarily cover the "www." subdomain.
I've dealt with this in my own personal experience before and found that Google Apps would process messages that various hosted Exchange providers would not. Some hosted Exchange providers do not even let you see what has been blocked (e.g. GoDaddy) and thus it makes it very difficult to troubleshoot.
Now, in your edited post, you mentioned that the script is now sending "from" the user-inputed address and that this has helped. You are correct to assume this has helped. Even though the sending IP address won't match the sender domain name, the receiving server likely has a policy to accept messages absent a specific reason not to (e.g. a blacklist entry or a complete lack of MX/SPF records for the domain name), even if the IP doesn't match the domain name.
These headers…
From: Kaye <nobody#www.abc.com>
Reply-To: kaye#mydomain.com
…are defective since the receiving server is mainly concerned with the "from" address. The reply-to address, although it may be valid, adds no credibility to a message and the mail server will not take the time to look at it if the "from" address is invalid or blacklisted.
This header…
Message-ID: <be82ada010a752b86440e86e5c24ca0a#www.abcinc.com>
…won't make a difference either way, despite the "www." in it. A Message-ID just needs to be unique and nothing else matters.

What would prevent WordPress from sending emails to non-local email addresses?

I have setup our blog on my local machine with PHP5.3/FastCGI and MySQL (Windows 7/IIS 7.5)... (FYI - I'm new to Windows Servers and IIS)
I got this message:
The e-mail could not be sent.
Possible reason: your host may have disabled the mail() function... when a co-worker clicked the 'lost password' link on the 'wp-login' page.
I defined our network's mail server via 'php.ini' and voila!- Lost password email worked. -or so I thought.
Turns out, emails such as the lost password and new-user (password) are only being successfully sent to users with our mail server's url address (johndoe#horsepowerfreaks.com)
So my question is: Why would WordPress not be able to send emails to email addresses outside our domain? I know the first thing people will guess (as I have) that it is something to do with our mail server (Microsoft Exchange Server)...
Could it be something to do with the config of WP?
This is almost certainly a security configuration problem with your Exchange SMTP server, not with WordPress. Take a look at this:
http://terenceluk.blogspot.com/2011/10/unable-to-relay-mail-to-external-domain.html

will php's mail() attempt to deliver to localhost?

We are having a problem with a web application delivering emails. Suppose the site lives on domain.com. Emails sent to manager#domain.com aren't being recieved by the client, but when we set it to developer#developersdomain.com or manager#aliasdomain.com they are received by the developer and the manager, respectively.
Is php's mail() command delivering email addresses to the location domain to localhost, instead of routing it through a mail server?
Sadly, this is the way that the mailserver itself works. It knows the machine it's on is domain.com and assumes the mailbox should be a local box.
This is why it's a good idea to have your server's domain name actually be a subdomain, even if it's just www.domain.com. That way, mail addressed to manager#domain.com is sent on to the mail server specified by domain.com's MX record.
That'll be a setting on your mail software at the serverside I guess! Check your software settings.

Categories