I am using phpmailer for sending emails, but I want to make a custom header for my compaign, by adding a textarea field that contain any custom header here is my code but i dont know where is the problem it not working i dont see my custom header in mail full header :
$headers = [];
foreach (preg_split('/[\r\n]+/', $_POST['customHeader']) as $line) {
list($name, $value) = explode(': ', $line, 2);
$headers[$name] = $value;
}
}
for ($hh=0; $hh < $headers.count; $hh++) {
$PHPMailer->addCustomHeader($name,$headers[$name]);
}
what can i do please , thanks in advance.
What I have tried:
i tried this code :
$headers = [];
foreach (preg_split('/[\r\n]+/', $_POST['customHeader']) as $line) {
list($name, $value) = explode(': ', $line, 2);
$headers[$name] = $value;
}
}
for ($hh=0; $hh < $headers.count; $hh++) {
$PHPMailer->addCustomHeader($name,$headers[$name]);
}