WierdGoku Posted February 17, 2008 Share Posted February 17, 2008 Hi, I've written s acript that takes a name, email address, subject and body from a HTML form and uses the mail() function to send it to a pre-defined email address. Problem is is that it does not send it to the recipient and returns false. Any suggestions are greatly appreciated The script is http://www.jqt-chinesemedicine.com/contact.php The form is http://www.jqt-chinesemedicine.com/contact.html and the phpinfo file is http://www.jqt-chinesemedicine.com/info.php Thanks for your help WierdGoku Link to comment https://forums.phpfreaks.com/topic/91559-mail-problems/ Share on other sites More sharing options...
rofl90 Posted February 17, 2008 Share Posted February 17, 2008 Is the 'to' defintely defined? also if your using a mysql db print mysql error, if not make sure the name in the 'to' is bewing redirected to an email. Link to comment https://forums.phpfreaks.com/topic/91559-mail-problems/#findComment-468976 Share on other sites More sharing options...
WierdGoku Posted February 17, 2008 Author Share Posted February 17, 2008 Yeah the 'to' field is already defined as a variable (ie $toAddress = "[email protected]"). I'm not using a mysql database as it is only going to one address. I've checked the address and it seems to be correct but it's still not going anywhere. the call to mail i'm using is: if (mail ('$toName<$toAddress>', $subject, $message, 'From: $fromName<$fromAddress>'. "\r\n")) php doesn't seem to be spilling out any errors but i'm unable to get into the server to change the config settings for that. there also doesn't seem to be any errors in the error log either ??? Link to comment https://forums.phpfreaks.com/topic/91559-mail-problems/#findComment-469067 Share on other sites More sharing options...
Stooney Posted February 17, 2008 Share Posted February 17, 2008 Can we see the code? Link to comment https://forums.phpfreaks.com/topic/91559-mail-problems/#findComment-469068 Share on other sites More sharing options...
WierdGoku Posted February 17, 2008 Author Share Posted February 17, 2008 i'll post a link to a txt file cos it won't let me post the script on here!! http://www.jqt-chinesemedicine.com/contact.txt Link to comment https://forums.phpfreaks.com/topic/91559-mail-problems/#findComment-469073 Share on other sites More sharing options...
Stooney Posted February 17, 2008 Share Posted February 17, 2008 try this. All I did is replace single quotes with double quotes. php won't parse variables inside single quotes. if (mail ("$toName<$toAddress>", $subject, $message, "From: $fromName<$fromAddress>". "\r\n")) Link to comment https://forums.phpfreaks.com/topic/91559-mail-problems/#findComment-469082 Share on other sites More sharing options...
WierdGoku Posted February 17, 2008 Author Share Posted February 17, 2008 oh thank you very, very much! that's been confusing me for hours! *gives chrisdburns a big hug* Link to comment https://forums.phpfreaks.com/topic/91559-mail-problems/#findComment-469092 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.