Jump to content

simple contact form question


mr_badger

Recommended Posts

I have created a simple contact form, uploaded it to my server, tested it out and get the message that the email has been sent but it never arrives in my email inbox, probabaly really simple.

 

This is the code for the contactsent.php

<?php
$name=$_POST['name'];
$email=$_POST['email'];
$message=$_POST['message'];
$to="myemailaddress.com";
$message="Name: $name n E-mail: $email n Comments: $comments n";
if(mail($to,"Contact from Pure.Salon contact form",$message,"From: $emailn")) {
echo "Thank you, your email has been sent.";
} else {
echo "Sorry but there is an error. Try again please.";
}
?>

Link to comment
https://forums.phpfreaks.com/topic/53465-simple-contact-form-question/
Share on other sites

<?php
$to      = "[email protected]";
$message = "Name: {$_POST['name']}\nE-mail: {$_POST['email']}\nComments: {$comments}\n"; // note that $comments is not initialized
if(mail($to, "Contact from Pure.Salong contact form", $message, "From: {$_POST['email']}"))
{
echo "Thank you,your email has been sent.";
}
else {
echo "Sorry but ere is an error. Try again please.";
}
?>

 

Are you doing this on localhost or a remote server?

For the Mail functions to be available' date=' PHP must have access to the sendmail binary on your system during compile time.[/quote']

Chances are that you haven't got any sendmail binary - I haven't got that either on my localhost.

 

About the code... why do you redeclare all the values? You can use arrays in strings...

Example 1074. Sending mail with an additional command line parameter.

 

The additional_parameters parameter can be used to pass an additional parameter to the program configured to use when sending mail using the sendmail_path.

<?php

mail('[email protected]', 'the subject', 'the message', null,

  '[email protected]');

?>

 

Have you tried the -f parameter ??? Some hosts require that for mail to be sent.

Thanks for the code but again this still does not work. The thing I cant work out is that I have the original code working on another website with the same hosting company and that works fine, but it wont work for this website.

 

Guess you have to talk with your host then...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.