friday
friday

Reputation: 313

How to remove hosting user name and hosting site address in php mail function

I created a php mail function in wordpress custom page and the php mail function work well. But, when I receive the email from that wp custom page, My email inbox say showing my hosting user name and [email protected] in email head section. So, is there any way to remove the user name and hosting site address? What I use the code in wordpress custom page are below,

 <?php
    if (isset($_REQUEST['email'])) {

$admin_mail = get_bloginfo('admin_email');

$header  .= 'MIME-Version: 1.0' . "\r\n";

$header .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

$header .= "Email From " . $_REQUEST['email'];

$subject = "Testing Form" ;

$message .= 'Testing Form For Removing user name ';

$message .= "email request and other Request are here";

mail( $admin_mail, "Subject: $subject",$message, $header );

} else {
    Here is form<form>
}
?>

Upvotes: 0

Views: 265

Answers (1)

user557846
user557846

Reputation:

this is not a valid mail header

$header .= "Email From " . $_REQUEST['email'];

try:

$headers = 'From: [email protected]' . "\r\n" .
    'Reply-To: [email protected]' . "\r\n" ;

Upvotes: 1

Related Questions