Jump to content

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 me@localhost.com when it should show info@myCompany.com.

 

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='myInbox@yahoo.com';

 

 

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/84672-php-problem-with-email-help-appreciated/
Share on other sites

Steve,

 

Hard code some values in there before you get into the $_POST part.  But, you are going to want to check all that post stuff before just sending it.  Also, I found that Yahoo mail for me was a little buggy, but when I changed the \r\n to just \n that solved a few problems.

 

It looks like you have an extra entry with $country.  This code might work.

 


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

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.