View Single Post
Old 2nd June 2009, 03:23 PM   #12 (permalink)
matt_b
Registered User
 
Join Date: Jun 2009
Posts: 8
Some progress...

I've got access to the error log, and there's a line which states:
Code:
malformed header from script. Bad header=/home/myuser/dead.letter...: php-script, referer: www.mydomain.co.uk/contact-us.html
And if I look in dead.letter, I can see the "bad" email as follows:
Code:
From myuser Tue Jun  2 15:58:04 2009
Return-Path: <myuser>
Received: (from myuser@localhost)
	by mydomain.co.uk (8.13.1/8.13.1/Submit) id n52Ew4fT018589;
	Tue, 2 Jun 2009 15:58:04 +0100
Date: Tue, 2 Jun 2009 15:58:04 +0100
Message-Id: <200906021458.n52Ew4fT018589@mydomain.co.uk>
To: info@mydomain.co.uk
Subject: Web Lead
X-Sender: Who you are
X-Mailer: PHP Contact Form
From: "Test User" <testuser@microsoft.com>
Reply-To: "Test User" <testuser@microsoft.com>
Mime-Version: 1.0
Content-type: text/plain; charset="us-ascii"\n

Call: Test User
Company: Test Company
Phone: 	0845 123456
Email: testuser@microsoft.com
Message: Testing testing 123
Now it seems obvious that the "bad header" is Return-Path. I've done some searching online and I can override the default return path by appending "-f user@mailbox.com" to the end of the mail command, like so:
Code:
mail("info@mydomain.co.uk", $subject, $message, $headers,"-f mymail@gmail.com");
If I do this, I don't get an error anymore (which is good), but the mail still doesn't get delivered - it gets returned to the sender. I checked my gmail account, and there's an NDR in there as follows:
Code:
Your message did not reach some or all of the intended recipients.

      Subject:	Web Lead
      Sent:	02/06/2009 16:14

The following recipient(s) cannot be reached:

            The e-mail account does not exist at the organization this message was sent to.  Check the e-mail address, or contact the recipient directly to find out the correct address.
            < mydomain.co.uk #5.1.1 SMTP; 550 5.1.1 <info@mydomain.co.uk>... User unknown>
Which implies that the original problem is solved, but for some reason the MTA is delivering mail addressed to my domain to itself, rather than forwarding it to my MX record.

Next question: how can I stop this?
matt_b is offline   Reply With Quote