Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Upgrade broke mail()

Status
Not open for further replies.

pmegan

Programmer
Aug 29, 2005
1,186
US
Hi,

My company's website is being hosted on a Network Solutions VPS. We purchased a php upgrade, 5.0 to 5.2.14, on the request of our new design company. Now the mail() function in our "contact us" forms isn't working correctly. I put up this little page and found that it's the headers argument causing the problems.

Code:
<?php 
	$to = "xxx@xxx.com";
	$subject = "this is only a test";
	$body = "holy headless horseman batman!";	
	$headers =  'From: xxx@xxx.com' . "\r\n";	
	
        echo("To: $to <br>Subject: $subject<br>Body: $body<br>Headers: $headers");
	mail($to,$subject,$body);
	mail($to,$subject,$body,$headers);
?>

The first mail() call works fine, the second gets trapped in our spam filter with an "illegal mime type" error.

We don't have anyone on staff who knows php or its configuration well enough to get this fixed. Network Solutions considers the upgrade successful and wants to bill us to get the mail function working. Before we get stuck forking over another couple hundred dollars I wanted to see if anybody here can help.

Any ideas?

Thanks,
Pat
 
the header looks fine.

more likely to be something wrong with your sendmail script.
 
I'm not sure what you mean; this is the sendmail script. Granted the live version picks up info that's posted from a form, but if I run this exact script I get one email instead of two.
 
Read about sendmail here.

possibly your sendmail or other MTA is configured to prevent sending by certain users (viz the From header) or otherwise does not like the way that you have constructed the header.

 
It looks to me that your spam filter is what is filtering this out (not the MTA via From header) based on the mime-type or lack of mime type.

More than likely in the absence of headers in the first call it is using some default headers when sending the mail, and is the working just fine. By specifying headers in the second call it might be overriding some headers that would allow it to get past your spam filter - in this case the mime type.

You might try adding the mime type to the headers to see if that helps (this usually requires two lines the MIME version and the Content type - see the php mail page for more information).
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Sponsor

Back
Top