Skip to content
Advertisement

How to change the me when receiving email on contact us

I’ve created an contact us form using PHP Mailer, however the problem is when I received the email the name before you open it is me and I can’t figured out how to fix it. Also I appreciate it if someone explain to me what is the different between Username and the add Address. Thank you in advance.

Here is the me I’m referring to

<?php
use PHPMailer;

if(isset($_POST['name']) && isset($_POST['email'])){
$name = $_POST['name'];
$email = $_POST['email'];
$subject = $_POST['subject'];
$body = $_POST['body'];

require_once "PHPMailer/PHPMailer.php";
require_once "PHPMailer/SMTP.php";
require_once "PHPMailer/Exception.php";

$mail = new PHPMailer();

//smtp settings
$mail->isSMTP();
$mail->Host = "smtp.gmail.com";
$mail->SMTPAuth = true;
$mail->Username = "";
$mail->Password = '';
$mail->Port = 465;
$mail->SMTPSecure = "ssl";
$mail->SetFrom("$email ", "$name");

//email settings
$mail->isHTML(true);
$mail->setFrom($_POST['email'], $_POST['email']);
$mail->addAddress("");
$mail->Subject = ("$email ($subject)");
$mail->Body = $body;

if($mail->send()){
    $status = "success";
    $response = "Email is sent!";
}
else
{
    $status = "failed";
    $response = "Something is wrong: <br>" . $mail->ErrorInfo;
}

exit(json_encode(array("status" => $status, "response" => $response)));
} 

Advertisement

Answer

You are sending mail from the same email address to the same email address.

So, many email clients identify yourself as me.

You will have to send using another email address, and you will be idenfied with your email/name.

As Jesse said: You can also send mail to another email, and it will usually not show me.

Advertisement