ethayne Posted October 7, 2008 Share Posted October 7, 2008 Hi all, I've got a simple mail script here for an html form. Everything seems to be working correctly except the actual mailing part. Here is the site for reference: http://www.littlesproutandco.com/splash PHP script: <?php $email=$_POST['email']; $body="The email address $email wants to be notified when the Little Sprout and Company website is finished!"; if ($email) { mail("[email protected]","Little Sprout Sign Up",$body,"From:LittleSprout") header("Location: success.php"); } else { header("Location: index.php"); } ?> Any idea what's going on? Thanks! Link to comment https://forums.phpfreaks.com/topic/127338-simple-mail-script-not-working/ Share on other sites More sharing options...
R0bb0b Posted October 7, 2008 Share Posted October 7, 2008 First thing that pops out is the missing semi-colon after <?php mail("[email protected]","Little Sprout Sign Up",$body,"From:LittleSprout") ?> Link to comment https://forums.phpfreaks.com/topic/127338-simple-mail-script-not-working/#findComment-658731 Share on other sites More sharing options...
ethayne Posted October 7, 2008 Author Share Posted October 7, 2008 Good catch, but I'm still not getting the message... Link to comment https://forums.phpfreaks.com/topic/127338-simple-mail-script-not-working/#findComment-658734 Share on other sites More sharing options...
R0bb0b Posted October 7, 2008 Share Posted October 7, 2008 do it like this <?php if(!mail("[email protected]","Little Sprout Sign Up",$body,"From:LittleSprout")) { print_r(error_get_last()); exit(); } ?> Link to comment https://forums.phpfreaks.com/topic/127338-simple-mail-script-not-working/#findComment-658741 Share on other sites More sharing options...
ethayne Posted October 7, 2008 Author Share Posted October 7, 2008 Okay, so apparently the problem has to do with GoDaddy (why do clients insist on using them for a host?). I'll get it straightened out with them. Thanks for the help. Link to comment https://forums.phpfreaks.com/topic/127338-simple-mail-script-not-working/#findComment-658744 Share on other sites More sharing options...
Brian W Posted October 7, 2008 Share Posted October 7, 2008 Do they not allow you to set you SMPT in the ini? I've had that problem with one server I was working with. I am just wondering because I have a few times told people to use them though I've never once used the myself, I just hear they are good for people just looking for a simple, user friendly host. If the mail() function has issues, that may ward me off from their serviced in the future. :-\ Link to comment https://forums.phpfreaks.com/topic/127338-simple-mail-script-not-working/#findComment-658748 Share on other sites More sharing options...
ethayne Posted October 7, 2008 Author Share Posted October 7, 2008 Well, maybe it's just my experience, but I've never been satisfied with GoDaddy. I've done some google searches and it seems I'm not the only one having problems with the mail() function. I'll be sure to post here what I find out from them. Link to comment https://forums.phpfreaks.com/topic/127338-simple-mail-script-not-working/#findComment-658803 Share on other sites More sharing options...
R0bb0b Posted October 7, 2008 Share Posted October 7, 2008 try phpmailer, there are many tutorials and example on their site. Link to comment https://forums.phpfreaks.com/topic/127338-simple-mail-script-not-working/#findComment-658806 Share on other sites More sharing options...
wrathican Posted October 7, 2008 Share Posted October 7, 2008 function sendMail($to, $subject, $message) { $headers = "From: SNT CMS <[email protected]>\r\n" . 'X-Mailer: PHP/' . phpversion() . "\r\n" . "MIME-Version: 1.0\r\n" . "Content-Type: text/html; charset=utf-8\r\n" . "Content-Transfer-Encoding: 8bit\r\n" . "Content-type: text/html; charset=iso-8859-1\r\n"; // Send $mailing = mail($to, $subject, $message, $headers); if ($mailing != false) { return true; }else{ return false; } } i use this homemade thing - enjoy use like so: <?php $email = '[email protected]'; $subject = 'Hello!'; $message = 'I <3 PHP'; $mailing = sendMail($email, $subject, $message); if($mailing == false){ //error capture }else{ //success capture } ?> Link to comment https://forums.phpfreaks.com/topic/127338-simple-mail-script-not-working/#findComment-658810 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.