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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP mail not working... good alternative?

Status
Not open for further replies.

archivist08

IS-IT--Management
May 10, 2004
8
US
My old website used PHP mail to e-mail contents of the filled form... it worked perfectly until I moved to the new host. Since then, although script reports that mail function was completed sucessfully, I don't receive the e-mail. I think my code is ok, here's the header and mail section of it:

$headers = "From: $email\r\n";
$headers .= "Reply-To: $email\r\n";
$headers .= "Return-Path: $email\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";

mail($to,$subject,$message,$headers)

I e-mailed the technical support and this is what they have told me:

This function will not work if it uses a system call to the mail function, you will have to send email another way. Unfortunately we do not provide script debugging support so I can not help you write the mail script.

Since I'm not that experienced with PHP and mail function, what that this mean? Is there no way to use PHP mail? And if not, what is a good alternative? I was trying to make cgiemail work for a while, but that didn't work that well either.

Note that executing phpinfo() on my new host tells me that sendmail_path is /usr/sbin/sendmail -t -i, and again, since I'm a new at PHP, it doesn't tell me very much. [neutral]
 
If PHP is running on a unix-like OS, it will invoke a fairly standard system application to send mail.

But lots of things could be causing the problem. Your new hosting provider could be on your email server's blackhole list. The new host could be misconfigured. The new host's mail server could be more picky about your message formatting.

Have you looked at PHPMailer? It is a very good class for sending complex emails. It also has builtin functionality for sending email through socket programming, if necessary.



Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Thank you!

it worked. I tried PHPmailer first using PHP sendmail option, and since that didn't do any good I used SMTP option, and that one worked...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top