Need Help - Mail function smtp

This is where you share YOUR scripts with others

Moderators: macek, egami, gesf

New php-forum User
New php-forum User
Posts: 1
Joined: Wed Nov 02, 2011 9:43 am

Need Help - Mail function smtp

Postby BenjaminVL » Wed Nov 02, 2011 9:48 am

I use this code to send my contactform information to my mailbox.
But it won't work. I won't receive an e-mail.
Normal i use but i'm learning PHP, so everyone's help is welcome!

$voornaam = $_REQUEST['naam'];
$from = $_REQUEST['mail'];
$tel = $_REQUEST['tel'];
$fax = $_REQUEST['fax'];
$bedrijf = $_REQUEST['bedrijf'];
$soort = $_REQUEST['soort'];
$bericht = $_REQUEST['bericht'];

$to = "";
$subject = "Emailbericht";
$headers = "From:" . $from;
$host = "";
$username = "";
$password = "mijnpaswoord";

$message = "
U heeft een bericht ontvangen van het CONTACTFORMULIER \n
$voornaam van het bedrijf $bedrijf ($mail) schreef het volgende bericht: \n \n

Omschrijving: $soort \n \n

$bericht \n \n

$bedrijf \n
$voornaam \n
$mail \n
$fax \n



mail($to, $subject, $message, $headers, $host, $username, $password);

execute HTML file

User avatar
php-forum GURU
php-forum GURU
Posts: 2196
Joined: Wed Oct 06, 2010 11:19 am
Location: Happy Valley, UT

Re: Need Help - Mail function smtp

Postby egami » Wed Nov 02, 2011 10:43 am

Aso.. mein Deutsch ist leider ganz schlecht, aber vieleicht Ich kann ein bissien hilfe geben..

Ich mache dis dingie auf English.

First of all, $_REQUEST should be either _POST or _GET, depending on how you have your form set up. Relying on Request is marginal.

use the following

IF mail($to,$subject,$message,$headers) {
echo "Mail sent successfully...";
} else {
echo "Mail not sent. There was an error. Check your error logs or figure out how to have the MAIL error displayed on THIS SCREEN.";

New php-forum User
New php-forum User
Posts: 8
Joined: Thu Nov 10, 2011 2:36 pm

Re: Need Help - Mail function smtp

Postby HvWinkel » Thu Nov 10, 2011 2:42 pm

Many good examples are available thru Google "php contactformulier"

This one ... mulier/12/
contains only a little bit af dutch language but it should not be a problem.

Works immediately after changing the e-mail address

Return to “Your Scripts”

Who is online

Users browsing this forum: No registered users and 0 guests