fogbreaker
fogbreaker

Reputation: 31

PHP mail replaces explicit from [email protected] with local hostname

I am currently having a struggle sending an email from PHP:

$header = "MIME-Version: 1.0\r\n";
$header .= "Content-type: text/html; charset=utf-8\r\n";
$header .= "From: [email protected]\r\n";
$header .= "Reply-To: [email protected]\r\n";
$header .= "X-Mailer: PHP " . phpversion();
mail("[email protected]", "Subject", "Body", $header);

The problem is that on receiver side, the mail has the sender address [email protected] (where example.net is the host the PHP script runs on).

example.com gets replaced by example.net all the time. I'm running Plesk and PHP 8.0.3. Any ideas?

Upvotes: 0

Views: 450

Answers (1)

fogbreaker
fogbreaker

Reputation: 31

Turned out that plesk has a feature called "Fix incorrectly set sender for outgoing mail under Tools & Settings > Mail Server.

unchecked that, works.

Upvotes: 3

Related Questions