Jump to content

Help with basic PHP mail script, please


SteveH

Recommended Posts

Hello

 

I have an online form which, when completed, should send me an email with the details of that user,

that is, his name, email address, business, country, and message.

 

When I receive the message in my inbox, however, it looks like this:

 

http://www11.brinkster.com/stevehigham/error.html

 

It does not show the name of the person who completed the form, or his email address. It is also

showing email 'From' as [email protected] when it should show [email protected].

 

To complicate matters, it uses 'education' (in the above link) as the Subject and it does not send

the user a copy of what he has input into the form.

 

What am I doing wrong, please?

 

The code looks like this:

 

<?php

 

//create short variable names

$name=$_POST['name'];

$email=$_POST['email'];

$business=$_POST['business'];

$country=$_POST['country'];

$message=$_POST['message'];

$name=trim($name);

$email=trim($email);

$business=StripSlashes($business);

$country=StripSlashes($country);

$message=StripSlashes($message);

 

/*#########

modify the next line with your own email address

###########*/

 

$toaddress='[email protected]';

 

 

mail("$toaddress","$business","$country","$message","From: $name <$email>\r\nReply-To: $email\r\nReturn-Path: $email\r\nCc: $email\r\n");

//clear the variables

$name='';

$email='';

$business='';

$country='';

$message='';

exit;

 

 

?>

 

 

Thank you.

 

Steve

 

 

Link to comment
https://forums.phpfreaks.com/topic/84472-help-with-basic-php-mail-script-please/
Share on other sites

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.