0

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: jan@example.com\r\n";
$header .= "Reply-To: jan@example.com\r\n";
$header .= "X-Mailer: PHP " . phpversion();
mail("receiver@example.org", "Subject", "Body", $header);

The problem is that on receiver side, the mail has the sender address xxx@example.net (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?

TRiG
  • 10,148
  • 7
  • 57
  • 107
fogbreaker
  • 31
  • 1
  • 4

1 Answers1

3

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

unchecked that, works.

fogbreaker
  • 31
  • 1
  • 4