EmailFrom help

the mail() function

Moderators: macek, egami, gesf

laneo
New php-forum User
New php-forum User
Posts: 3
Joined: Tue Apr 12, 2011 3:49 am

EmailFrom help

Postby laneo » Wed Apr 20, 2011 6:46 am

I have a form that uses the post method which sends a email to the relevant persons email address. I have created the script and it all works fine;

$EmailFrom = Trim(stripslashes($_POST['name']));
$EmailTo = "*****";
$Subject = "*****";
$Subject = "**** " . $Subject;

$Name = Trim(stripslashes($_POST['name']));
$Email = Trim(stripslashes($_POST['email']));
$Telephone = Trim(stripslashes($_POST['telephone']));
$Course = Trim(stripslashes($_POST['courseName']));
$Message = Trim(stripslashes($_POST['message']));

// body text

$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "\n";
$Body .= "eMail: ";
$Body .= $Email;
$Body .= "\n";
$Body .= "\n";
$Body .= "Contact number: ";
$Body .= $Telephone;
$Body .= "\n";
$Body .= "\n";
$Body .= "Course or Module name: ";
$Body .= $Course;
$Body .= "\n";
$Body .= "\n";
$Body .= "Message:";
$Body .= "\n";
$Body .= $Message;
$Body .= "\n";

// send email
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");

______________________

The problem being that the resulting email that is received comes in with the from being from the name which is what I want, but then this is followed by the domain.

e.g. berty bassett@ourdomain.com

I don't want the domain after the name.

The subject comes through fine without any extra bits after it. If you're wondering why there's 2 subjects it's because of our spam filter.

I'm confused, please help!

cheers
James

annyphp
New php-forum User
New php-forum User
Posts: 76
Joined: Sun Nov 28, 2010 6:33 pm
Contact:

Re: EmailFrom help

Postby annyphp » Wed Apr 20, 2011 6:19 pm

Suggest anther wonderful PHP email scripts:
Safe email creates an bot safe e-mail address for contact form, by masking the real email address, this script protects its owner from unwanted bot page scans and automatic spam receiving. It takes the e-mail user name, host name and top level domain name and creates a string with the e-mail address replaced the @ character by the at text.
Check out http://www.phpkode.com/scripts/item/safe-email/...

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

Re: EmailFrom help

Postby egami » Thu Apr 21, 2011 6:18 am

Code: Select all



$array 
explode("@","berty bassett@ourdomain.com");
$name $array['0'];
echo 
$name;


 


Return to “PHP coding => Mail”

Who is online

Users browsing this forum: No registered users and 1 guest