0

I have a code to send mails, the code work fine and mail sent but I get the mail from an address wird the mail that I get the email from: [email protected]

my code:

$from = 'From: [email protected]';
if (!sendMail($_POST['mail'], $text['EMAIL_RECOVER_MSG_SUBJECT'], $text['EMAIL_RECOVER_MSG'], $from))

the send mail function:

 function sendMail ($to, $subject, $msg, $from, $add = null) {
$from = array($from,
"Reply-To: [email protected]",
"X-Mailer: PHP/" . PHP_VERSION
 );
 $from = implode("\r\n", $headers);
return mail($to, $subject, $msg, $from);
}
sdfds dffdsf
  • 61
  • 1
  • 2
  • 7

1 Answers1

1

Remove From: from value of variable $from

Change from

$from = 'From: [email protected]';

Into

$from = '[email protected]';

It is recommended to use PHPMailer class.

Muhammad Hassaan
  • 7,296
  • 6
  • 30
  • 50