PDA

View Full Version : Email in PHP Script Problems.


Pc-Gamer
03-10-2004, 11:31 AM
I have saw other threads about this and still haven't found my answer. I have submitted a ticket to HR but want to get this resolved ASAP.
I have been using this script on HostRocket since July 2002. It has worked fine in the past but now it will not send email out. I am assuming that HR has update PHP and maybe I need to alter the script a bit. Here is a little snippet of the script:

//SEND EMAIL FROM LOCAL HOST
function sendmail_local($toname, $toemail, $emailsubject, $emailbody){
global $email, $site;

$subject="$site[shortname] $emailsubject";
$body="$emailbody\n\n$site[longname]\n$site[homeurl]\n";
$fromname="$site[shortname]";
$fromemail="$email[sendaccount]";
$replyname="$site[shortname]";
$replyemail="$email[genhelp]";

mail("$toname <$toemail>","$subject","$body", "From: $fromname <$fromemail>\nReply-To: $replyname <$replyemail>\nContent-type: text/plain\nX-Mailer: PHP/" . phpversion());
}


I would appreciate any help.

Thanks
Mike

jhillman
03-11-2004, 03:30 PM
I just tried your snippet of code and it works great on my server.

-Joe
3D Screensavers and more... (http://webappstogo.com)

Pc-Gamer
03-11-2004, 03:38 PM
Thanks, HR support said the same thing. I found that it does work for emails outside my domain.... I have tested it using my own domain email addresses and has failed...
So hopefully support can help.



Thanks

HRMike
03-12-2004, 03:58 AM
From a quick look at your code snippet it appears that you do not have the header fields specified correctly. You should be using "\r\n" to seperate the header fields and not just "\n". While some mail servers including some of own will accept mail formated like this, the RFCs are pretty clear that "\r\n" should seperate the header fields.