I try to use php mail function to build my contact page but , i dont recieve mails. No errors , none shows.
PHP mail function ?
Try posting the code so we can actually help 
just tested the mail() function on frih.net and it works fine for me. So the error is probably in the script. Or the recipients mail/spam filters maybe.
used this 1 for a while
This is a piece. Take what u need or get ideas
This is a piece. Take what u need or get ideas
| Code: |
| <?php
$pagina = $_GET['pagina']; if (getenv(HTTP_CLIENT_IP)) { $user_ip=getenv(HTTP_CLIENT_IP); } else { $user_ip=getenv(REMOTE_ADDR); } if ($pagina == contact) { $pagetitle = "Contact"; $body = "<script type=\"text/javascript\"> function imposeMaxLength(Object, MaxLen) { return (Object.value.length <= MaxLen); } </script> <form action=\"index.php?pagina=mail\" method=\"post\"> <table> <tr> <td>Naam:</td><td><input type=\"text\" name=\"naam\" maxlength=\"50\" size=\"30\" /></td> </tr> <tr> <td>Email:</td><td><input type=\"text\" name=\"email\" maxlength=\"50\" size=\"30\" /></td> </tr> <tr> <td>Bericht:</td><td><textarea name=\"bericht\" rows=\"10\" cols=\"45\" onkeypress=\"return imposeMaxLength(this, 1000);\"></textarea></td> </tr> <tr> <td colspan=\"2\"><input type=\"submit\" name=\"submit\" value=\"Stuur\" /></td> </tr> </table> </form><br /><br />Uw ip is: $user_ip. Uw ip is opgeslagen op spam te voorkomen."; } elseif ($pagina == 'mail') { $naam = $_POST['naam']; $email = $_POST['email']; $bericht = $_POST['bericht']; if(!$email == "" && (!strstr($email,"@") || !strstr($email,"."))) { $pagetitle = "Mislukt!"; $body = "U heeft geen geldig emailadres ingevuld<br /><br /><a href='javascript:history.back()'>Terug</a>"; } elseif(empty($naam) || empty($email) || empty($bericht)) { $pagetitle = "Mislukt!"; $body = "U heeft niet alles ingevuld<br /><br /><a href='javascript:history.back()'>Terug</a>"; } else { $pagetitle = "Verstuurd!"; $body = "Uw mail is verstuurd!<br /><br /><a href='index.php'>Index</a><br /><br /><hr /><br /> <table> <tr> <th colspan='2' align='left'>Uw Bericht</th> </tr> <tr> <td>Naam:</td><td><input type=\"text\" name=\"naam\" size=\"30\" readonly=\"true\" value=\"$naam\" /></td> </tr> <tr> <td>Email:</td><td><input type=\"text\" name=\"email\" size=\"30\" readonly=\"true\" value=\"$email\" /></td> </tr> <tr> <td>Bericht:</td><td><textarea name=\"bericht\" rows=\"10\" cols=\"45\" readonly=\"true\">$bericht</textarea></td> </tr> <tr> <td>IP:</td><td><input type=\"text\" name=\"ip\" size=\"30\" readonly=\"true\" value=\"$user_ip\" /></td> </tr> </table>"; $youremail="webmaster@XXXXXX.frih.net"; $emailsubject="Contact form van site!"; $from_who="Van de site"; $mailbody="Naam:\n=================\n$naam\n\n"; $mailbody.="Email:\n=================\n$email\n\n"; $mailbody.="Bericht:\n=================\n$bericht\n\n"; $mailbody.="IP Number:\n=================\n$user_ip\n\n"; mail("$youremail", "$emailsubject", "$mailbody", "From: $from_who"); } } else { $pagetitle = "Index"; $body = "<i>(19-4-2006)</i> |
i used the simplest way,
$name = $HTTP_POST_VARS['name'] ;
$msg = $HTTP_POST_VARS['msg'] ;
$from = $HTTP_POST_VARS['from'] ;
mail("my@gmail.com",$name,$msg,$from);
$name = $HTTP_POST_VARS['name'] ;
$msg = $HTTP_POST_VARS['msg'] ;
$from = $HTTP_POST_VARS['from'] ;
mail("my@gmail.com",$name,$msg,$from);
anything wrong in this code part ?
| Quote: |
| $name = $HTTP_POST_VARS['name'] ;
$msg = $HTTP_POST_VARS['msg'] ; $from = $HTTP_POST_VARS['from'] ; |
I'm not sure, but maybe it's because you used post variables instead of get, it depends of your input form.
Maybe try it with something like.
| Quote: |
| $name = $HTTP_GET_VARS['name'] ;
$msg = $HTTP_GET_VARS['msg'] ; $from = $HTTP_GET_VARS['from'] ; |
Otherwise, it might be easier to just show the form in question and I'll take a look at it.
thx for the help guys . now its working . there was nothig wrong in code. It just seem yahoo didnt like them and late little time to delever them. even that to bulk folder.
Related topics
