PHP script emails are sent out

To set the correct headers for the Return-Path you need to use the code like below:
putenv ("QMAILUSER=USER");
putenv ("QMAILNAME=FULL_USER_NAME");
putenv ("QMAILHOST=DOMAIN");
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/plain;charset=us-ascii\r\n";
$headers .= "From: FULL_USER_NAME ";
$to="mail@domain.tld";
$subject = "Testing email";
$body = "";
$err = mail($to, $subject, $body, $headers);
 
In result mail will have FULL_USER_NAME in Return-Path.

Add Feedback