class CHmail{
var $to = null;
var $from = null;
var $reply = null;
var $subject = null;
var $body = null;
var $headers = null;
public function __construct($to,$from,$reply,$subject,$body){
$this->to = $to;
$this->from = $from;
$this->reply = $reply;
$this->subject = $subject;
$this->body = $body;
}
public function send(){
$this->addHeader('From: '.$this->from." <".$this->reply."> \n");
$this->addHeader('Reply-To: '.$this->reply."\n");
$this->addHeader('Return-Path: '.$this->from."\n");
$this->addHeader('X-mailer: ZFmail 1.0'."\n");
$this->addHeader('Content-type: text/html; charset=utf-8'."\n");
mail($this->to,$this->subject,$this->body,$this->headers);
}
function addHeader($header){
$this->headers .= $header;
}
}
Dan gebruik ik de mail zo
ob_start();
include(DOC_ROOT.'inc/email_contact.php');
$myHTML = ob_get_clean();
$bericht = preg_replace('~[\n\r\s]+~',' ', $myHTML);
$email = 'info@'.TRADE_URL.'';
$mailReg = new CHmail($_POST['contact-email'],$from,$reply,'Contact '.TRADE_URL.'',$bericht);
$mailReg->send(); De mail word verstuurd in Raw format.
Terwijl dit html emails zijn.
Dit is gebeurd net toen ik de overzetting naar php8.1 heb gemaakt;
In php 7.3 werkte alles prima.
Kent iemand dit probleem?