SenenCito Posted June 26, 2006 Share Posted June 26, 2006 Good day please excuse my extremely rude way of registering to the forums and immediatly posting a help topic, this problem has me losing more hair daily and my web administrator seems to believe the problem is in the code, after trying and trying I would like to see if you guys can help me nail down the exact cause of the problem.Its quite simple, I cant send email, in trying and trying I cut down the code to the bare and to just an example...currently this is the codehmm for some reason I cant post the code, its actually really smallwell this is frustrating, I cant post the code, it gives me an error and just wont let me post.., its only like 7 lines long, is there a defense against code posting in this forums? I didnt think I read that in the posting guidelines Quote Link to comment https://forums.phpfreaks.com/topic/12964-mail-problem/ Share on other sites More sharing options...
redarrow Posted June 26, 2006 Share Posted June 26, 2006 Another example of sending a utf-8 HTML mail:[code]$to = 'bob@barnyard.com';$subject = 'Wakeup bob!';$message = '<b>yo</b>, whassup?';$headers = "From: server@barnyard.com\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\r\n";// Sendmail($to, $subject, $message, $headers); [/code]Good luckThe link for mail[a href=\"http://uk.php.net/manual/en/ref.mail.php\" target=\"_blank\"]http://uk.php.net/manual/en/ref.mail.php[/a] Quote Link to comment https://forums.phpfreaks.com/topic/12964-mail-problem/#findComment-49839 Share on other sites More sharing options...
SenenCito Posted June 27, 2006 Author Share Posted June 27, 2006 [!--quoteo(post=388247:date=Jun 26 2006, 06:44 PM:name=redarrow)--][div class=\'quotetop\']QUOTE(redarrow @ Jun 26 2006, 06:44 PM) [snapback]388247[/snapback][/div][div class=\'quotemain\'][!--quotec--]Another example of sending a utf-8 HTML mail:[code]$to = 'bob@barnyard.com';$subject = 'Wakeup bob!';$message = '<b>yo</b>, whassup?';$headers = "From: server@barnyard.com\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\r\n";// Sendmail($to, $subject, $message, $headers); [/code]Good luckThe link for mail[a href=\"http://uk.php.net/manual/en/ref.mail.php\" target=\"_blank\"]http://uk.php.net/manual/en/ref.mail.php[/a][/quote]ok that is almost about the exact code I have, its a basic example code, Ive put the code in my personal server and the server im workign on and ive included a phpinfo echo to see if anyone can help me spot why it isnt sending[a href=\"http://senencito.com/gm/test.php\" target=\"_blank\"]http://senencito.com/gm/test.php[/a][a href=\"http://www2.royalmotorspr.com/test.php\" target=\"_blank\"]http://www2.royalmotorspr.com/test.php[/a] Quote Link to comment https://forums.phpfreaks.com/topic/12964-mail-problem/#findComment-50053 Share on other sites More sharing options...
AndyB Posted June 27, 2006 Share Posted June 27, 2006 [!--quoteo(post=388467:date=Jun 27 2006, 08:09 AM:name=SenenCito)--][div class=\'quotetop\']QUOTE(SenenCito @ Jun 27 2006, 08:09 AM) [snapback]388467[/snapback][/div][div class=\'quotemain\'][!--quotec--]ok that is almost about the exact code I have, its a basic example code, Ive put the code in my personal server and the server im workign on and ive included a phpinfo echo to see if anyone can help me spot why it isnt sending[a href=\"http://senencito.com/gm/test.php\" target=\"_blank\"]http://senencito.com/gm/test.php[/a][a href=\"http://www2.royalmotorspr.com/test.php\" target=\"_blank\"]http://www2.royalmotorspr.com/test.php[/a][/quote]On the first server, register_globals is ON (old, outdated, potentially dangerous), whereas on the second server register_globals is OFF. The difference is that on the second server you need to retrieve information passed (by URL or form) from the $_GET or $_POST array rather than just expecting the variables to be there. For example:[code]<?php$my_name = $_POST['my_name']; // retrieve my_name via POSTed form[/code] Quote Link to comment https://forums.phpfreaks.com/topic/12964-mail-problem/#findComment-50056 Share on other sites More sharing options...
SenenCito Posted June 27, 2006 Author Share Posted June 27, 2006 [!--quoteo(post=388470:date=Jun 27 2006, 08:17 AM:name=AndyB)--][div class=\'quotetop\']QUOTE(AndyB @ Jun 27 2006, 08:17 AM) [snapback]388470[/snapback][/div][div class=\'quotemain\'][!--quotec--]On the first server, register_globals is ON (old, outdated, potentially dangerous), whereas on the second server register_globals is OFF. The difference is that on the second server you need to retrieve information passed (by URL or form) from the $_GET or $_POST array rather than just expecting the variables to be there. For example:[code]<?php$my_name = $_POST['my_name']; // retrieve my_name via POSTed form[/code][/quote]that I was aware off, but I dont believe any of that actually impacts this code, since im not referencing variables nor using global variables, in it , this is the exact code[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--][code]$to = 's.llanos@royalmotorspr.com';$subject = 'the subject';$message = 'hello';$headers = 'From: webmaster@example.com' . "\r\n" . 'Reply-To: webmaster@example.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion();if ( mail ( $to, $subject, $message, $headers ) ){ echo "email has been sent<br><br>";}else{echo "email <strong>hasnt</strong> been sent<br><br>";}echo phpinfo ( );[/code][/quote] Quote Link to comment https://forums.phpfreaks.com/topic/12964-mail-problem/#findComment-50119 Share on other sites More sharing options...
wildteen88 Posted June 27, 2006 Share Posted June 27, 2006 And that isn't sending the email? Make sure you check that emails are not being sent to your Junk/spam folders as emails sent with PHP usually get treated as spam.Also make sure the server you are sending the email from has an SMTP server installed/configured. Otherwise no emails will be sent, regardless of what your if statement returns. Mail doesnt check the success of the email, it just checks that your have filled in the parameters correctly. Quote Link to comment https://forums.phpfreaks.com/topic/12964-mail-problem/#findComment-50173 Share on other sites More sharing options...
SenenCito Posted June 27, 2006 Author Share Posted June 27, 2006 [!--quoteo(post=388590:date=Jun 27 2006, 02:14 PM:name=wildteen88)--][div class=\'quotetop\']QUOTE(wildteen88 @ Jun 27 2006, 02:14 PM) [snapback]388590[/snapback][/div][div class=\'quotemain\'][!--quotec--]And that isn't sending the email? Make sure you check that emails are not being sent to your Junk/spam folders as emails sent with PHP usually get treated as spam.Also make sure the server you are sending the email from has an SMTP server installed/configured. Otherwise no emails will be sent, regardless of what your if statement returns. Mail doesnt check the success of the email, it just checks that your have filled in the parameters correctly.[/quote]I already checked if it was junk mail, nothing. from the phpinfo it looks like SMTP is installed but I will ring once again the web host and bother him some more to see if it is indeed correctly configured, any other way to check that?and if mail just checks if the parameters are correct, then why is the exact same code on extremely similar versions of php behaving differently..I dont know its really driving me nuts Quote Link to comment https://forums.phpfreaks.com/topic/12964-mail-problem/#findComment-50221 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.