Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => Mail

What am I doing wrong??

the mail() function

Moderators: macek, egami, gesf

What am I doing wrong??

Postby Thierry » Sat Aug 13, 2005 10:12 pm

Code: Select all
<html>
<title>Verstuur</title>
<body bgcolor="#ececec">
<form action="verstuur.php" method="post">
<table border="0" cellspacing="15">

<tr><td><font face="arial" size="3">Naam         </font></td><td><input type="text" size="30" name="name">             </td></tr>
<tr><td><font face="arial" size="3">Onderwerp       </font></td><td><input type="text" size="30" name="subject">   </td></tr>
<tr><td><font face="arial" size="3">Bericht          </font></td><td><input type="text" size="30" name="message">    </td></tr>
<tr><td><font face="arial" size="3">Email          </font></td><td><input type="text" size="30" name="email">        </td></tr>

<tr><td><input type="submit" value="Verstuur"></td></tr>
</table>
</form>
</body>
</html>


------------------------------------------------------------------------------------------------------------------------------------------------

Code: Select all
<?php

$name = $_POST['name'];
$subject = $_POST['subject'];
$body = $_POST['message'];
$email = $_POST['email'];


$headers = "Van: $name<$email>\r\n";
$message = "
   
   Naam: $name
       Email: $email
       Wachtwoord: $body";


mail("myEmail@rara.com", $subject, $message,"Van: $name<$email>");

echo "Bedankt ". $name ."!";

?>


When I send an email I get the message 'Bedankt' and the name of the person but i don't recieve an email. Please help me. I've been trying to make this work for almost a whole day now and it is driving me crazy! So please help me... Thanks
Thierry
New php-forum User
New php-forum User
 
Posts: 2
Joined: Sat Aug 13, 2005 10:04 pm

Postby Alexej Kubarev » Sun Aug 14, 2005 1:27 am

firt of all you are not using code tags when posting... i have fixed that.

now:

Code: Select all
$headers = "Van: $name<$email>\r\n";


is incorrect as there is no Van header. and even if writing in dutch you still have to use english headers: From, Reply-To and so on.

now replace the last parameter with $headers in this line
Code: Select all
mail("myEmail@rara.com", $subject, $message,"Van: $name<$email>");


make sure you have configured your smtp server and php to use the correct server
User avatar
Alexej Kubarev
Site Admin
Site Admin
 
Posts: 2223
Joined: Fri Mar 05, 2004 7:15 am
Location: Täby, Stockholms län

Postby Thierry » Sun Aug 14, 2005 6:35 am

How do I check my smtp setting? Cause I have tried every way to make this work..
Thierry
New php-forum User
New php-forum User
 
Posts: 2
Joined: Sat Aug 13, 2005 10:04 pm

Postby Alexej Kubarev » Sun Aug 14, 2005 7:56 am

did you check php.ini smtp section`?

you need to set the correct values there for mail function to work..
User avatar
Alexej Kubarev
Site Admin
Site Admin
 
Posts: 2223
Joined: Fri Mar 05, 2004 7:15 am
Location: Täby, Stockholms län


Return to PHP coding => Mail

Who is online

Users browsing this forum: No registered users and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.