Jump to content


Photo

mail problem


  • Please log in to reply
6 replies to this topic

#1 SenenCito

SenenCito
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 26 June 2006 - 10:34 PM

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 code


hmm for some reason I cant post the code, its actually really small

well 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

#2 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 26 June 2006 - 10:44 PM


Another example of sending a utf-8 HTML mail:


$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";

// Send
mail($to, $subject, $message, $headers); 


Good luck

The 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]
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#3 SenenCito

SenenCito
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 27 June 2006 - 12:09 PM

[!--quoteo(post=388247:date=Jun 26 2006, 06:44 PM:name=redarrow)--][div class=\'quotetop\']QUOTE(redarrow @ Jun 26 2006, 06:44 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
Another example of sending a utf-8 HTML mail:


$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";

// Send
mail($to, $subject, $message, $headers); 


Good luck

The 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]

#4 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 27 June 2006 - 12:17 PM

[!--quoteo(post=388467:date=Jun 27 2006, 08:09 AM:name=SenenCito)--][div class=\'quotetop\']QUOTE(SenenCito @ Jun 27 2006, 08:09 AM) View Post[/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:
<?php
$my_name = $_POST['my_name']; // retrieve my_name via POSTed form

Legend has it that reading the manual never killed anyone.
My site

#5 SenenCito

SenenCito
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 27 June 2006 - 03:33 PM

[!--quoteo(post=388470:date=Jun 27 2006, 08:17 AM:name=AndyB)--][div class=\'quotetop\']QUOTE(AndyB @ Jun 27 2006, 08:17 AM) View Post[/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:
<?php
$my_name = $_POST['my_name']; // retrieve my_name via POSTed form
[/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--]
$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 ( );
[/quote]

#6 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 27 June 2006 - 06:14 PM

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.

#7 SenenCito

SenenCito
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 27 June 2006 - 08:45 PM

[!--quoteo(post=388590:date=Jun 27 2006, 02:14 PM:name=wildteen88)--][div class=\'quotetop\']QUOTE(wildteen88 @ Jun 27 2006, 02:14 PM) View Post[/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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users