Shibbir
Shibbir

Reputation: 21

PHP email issue

I've a HTML signup form with php. After a successfully submit it sends a confirmation email to the user email address.

Well, when user see his/her email it's shown as:

[email protected]

But I didn't add the @mediaplan.ovh.net part to the email address. Why it's showing in this address. @mediaplan.ovh.net? and how do i remove it?

php email code:

$to = "$email";                     
$subject = "Signup | Verification";
$message = "Congratulation $f_name $l_name you have been successfully registered. 
Please click the link to active your account.\r\n";
$message .= "http://www.maaks.fr/hotel/verify.php?email=$email&hash=$hash\r\n";

$from = "Yoursite.com";
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-rype: text/html; charset=iso-8859-1\r\n";
$headers .= "Content-Transfer-Encoding; 7bit\r\n";
$headers = "From:" . $from . "r\n";

$mailsent = mail($to,$subject,$message,$headers); 

Upvotes: 1

Views: 212

Answers (2)

Starx
Starx

Reputation: 79069

First, You are missing a slash in your from header part.

$headers = "From:" . $from . "r\n";
                          //  ^ Here

Change From headers while sending the mail

$from = "WebsiteName <[email protected]>";
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-rype: text/html; charset=iso-8859-1\r\n";
$headers .= "Content-Transfer-Encoding; 7bit\r\n";
$headers = "From: " . $from . "\r\n";

Upvotes: 3

Saleem
Saleem

Reputation: 1049

Try changing $from to email address.

$from = "[email protected]";

Upvotes: 1

Related Questions