|
2nd June 2009, 08:22 AM
|
#1 (permalink)
| | Registered User
Join Date: Jun 2009
Posts: 8
| php mail() works, but only when I send to other domains I've just signed up and moved my hosting to UH, and everything is working well so far.
However, on my site I have a contact form that has stopped working - upon submission I get the following error: Code: Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, info@mydomain.co.uk and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log. If I change the email address from info@mydomain.co.uk to my personal gmail address, it works fine.
The PHP code behind my contact form is below: Code: $name = $_REQUEST['name'];
$company = $_REQUEST['company'];
$email = $_REQUEST['email'];
$phone = $_REQUEST['phone'];
$msg = $_REQUEST['msg'];
$todayis = date("l, F j, Y, g:i a") ;
$subject = "Web Lead";
$message = "Call: $name\nCompany: $company/nPhone: $phone\nEmail: $email\nMessage: $msg\n";
$headers = "From: Web Lead <weblead@mydomain.co.uk>\r\nX-Mailer: php";
mail("info@mydomain.co.uk", $subject, $message, $headers); My nameservers have been changed to UH, MX records created etc. and all other email to @mydomain.co.uk works fine.
Does anyone have an idea what I need to change?
Thanks
Matt |
| |
2nd June 2009, 12:11 PM
|
#2 (permalink)
| | Senile Member
Join Date: Mar 2005
Posts: 1,227
| I suspect mailfoundry is eating it because it considers it a malformed email and is therefore bad spam.
try the following: Code:
$mailheaders = "X-Sender: Who you are\n";
$mailheaders .= "X-Mailer: PHP Contact Form\n";
$mailheaders .= "From: \"".$name."\" <".$_REQUEST["Email"].">\n";
$mailheaders .= "Reply-To: \"".$name."\" <".$_REQUEST["Email"].">\n";
$mailheaders .= "Mime-Version: 1.0\n";
$mailheaders .= 'Content-type: text/plain; charset="us-ascii"\n';
__________________
An old dog learning new tricks
|
| |
2nd June 2009, 01:39 PM
|
#3 (permalink)
| | Munky!
Join Date: Sep 2003 Location: nr Woking, England
Posts: 2,646
| If it's a local domain it will never make it to the MailFoundry appliance and it certainly wouldn't cause an ISE.
What does the error log? (Download from the site admin control panel).
Ben |
| |
2nd June 2009, 01:43 PM
|
#4 (permalink)
| | Registered User
Join Date: Jun 2009
Posts: 8
| Thanks for your reply but I still get the same error message.
Likewise, if I change the delivery address from info@mydomain.co.uk to my gmail address, it all works fine.
It's almost as if it's a DNS issue, or a problem with mail aliases within sendmail / postfix / whatever the MTA is.
If it's any clue I don't use webmail - I have one MX record that points to my local server here. |
| |
2nd June 2009, 01:45 PM
|
#5 (permalink)
| | Registered User
Join Date: Jun 2009
Posts: 8
| Sorry, should have mentioned I've checked the server error log and it is empty |
| |
2nd June 2009, 02:33 PM
|
#6 (permalink)
| | Senile Member
Join Date: Mar 2005
Posts: 1,227
| in your message you have /nPhone which should be \nPhone but since its in the message I don't think thats the problem.
__________________
An old dog learning new tricks
|
| |
2nd June 2009, 02:34 PM
|
#7 (permalink)
| | Registered User
Join Date: Jun 2009
Posts: 8
| Thanks, have fixed that but you're right - it's not the problem |
| |
2nd June 2009, 02:37 PM
|
#8 (permalink)
| | Senile Member
Join Date: Mar 2005
Posts: 1,227
| I trust that you have tested that normal email arrives in your inbox?
__________________
An old dog learning new tricks
|
| |
2nd June 2009, 02:38 PM
|
#9 (permalink)
| | Registered User
Join Date: Jun 2009
Posts: 8
| yup, all other email gets to me just fine :S |
| |
2nd June 2009, 02:41 PM
|
#10 (permalink)
| | Senile Member
Join Date: Mar 2005
Posts: 1,227
| if the contact form is running under https you won't see anything in the logs if you are using shared ssl. You would have to ask support to tell you whats in the log.
__________________
An old dog learning new tricks
|
| |
2nd June 2009, 02:53 PM
|
#11 (permalink)
| | Senile Member
Join Date: Mar 2005
Posts: 1,227
| also try: PHP Code: $mailreturn = mail("info@mydomain.co.uk", $subject, $message, $headers);
then test $mailreturn to see if its true or not.
__________________
An old dog learning new tricks
|
| |
2nd June 2009, 03:23 PM
|
#12 (permalink)
| | 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? |
| |
2nd June 2009, 04:07 PM
|
#13 (permalink)
| | Registered User
Join Date: Jun 2009
Posts: 8
| I've confirmed that this is definately the case: I've created a new UH user called "info", and I no longer get the NDR to my gmail address, and if I check my squirrelmail with the user "info", the email is there.
I don't want to use any of the mail services provided by UH, so this is not a long-term solution to this problem. I need to be able to tell sendmail to use the MX record and that it is not responsible for any of my email - can I do this? |
| |
3rd June 2009, 02:15 PM
|
#15 (permalink)
| | Registered User
Join Date: Jun 2009
Posts: 8
| Excellent, turning off email in the reseller area fixed the problem
It did, however, delete my MX record so watch out future readers - if you disable email then you'll need to put your MX records back in straight away! |
| |
2nd July 2009, 01:37 AM
|
#16 (permalink)
| | Registered User
Join Date: Jan 2008
Posts: 4
| Hi
I have exactly this problem (launched a website for a client but a 3rd party is handling their email).
Sounds like I need to do what percepts says but when I visit http://www.unitedforums.co.uk/vb/res...d-account.html
(when logged in), I get "paulbaker, you do not have permission to access this page"
Could someone paste the relevant text here please? I'm gussing it's a case of doing reseller home -> List sites -> Click on edit icon -> untick various email options which are currently (by default) all ticked.
Thanks! |
| |
2nd July 2009, 08:42 AM
|
#17 (permalink)
| | Senile Member
Join Date: Mar 2005
Posts: 1,227
| If you have a reseller account, then you must ask support to allow you access to the reseller chat forum.
If you do not have a reseller account, then you need to ask support to switch off email.
You are correct that email can be switched off in the reseller control panel when editing a specific domains settings.
__________________
An old dog learning new tricks
|
| |
3rd July 2009, 08:34 AM
|
#18 (permalink)
| | Registered User
Join Date: Jan 2008
Posts: 4
| Thank you percepts
Yes I am a reseller and I have now obtained access to that area.
Yes it's just a case of unticking all the boxes in MAIL and WEB-BASED EMAIL ACCESS sections.
All appears to be working OK now.
Cheers |
| | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | | | | Thread Tools | | | | Display Modes | Rate This Thread | Linear Mode | |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | | |