I created a function to handle email sending using PHPMailer
this is the function:
function sendEmail($from, $replyTo, $to, $subject, $message) {
$mail = new PHPMailer;
//$mail->SMTPDebug = 3; // Enable verbose debug output
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'mail.pickbyclick.ro'; // Specify main and backup SMTP servers
$mail->SMTPAuth = false;
$mail->Username = 'admin@pickbyclick.ro';
$mail->Port = 25;
$mail->setFrom($from, 'Pick by Click Team');
$mail->addReplyTo($replyTo);
$mail->addAdress($to);
$mail->isHTML(true);
$mail->Subject = $subject;
$mail->Body = emailShowNice($message);
$mail->AltBody = $message;
if(!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent';
}
}
And after this call
sendEmail($from, "no-reply@pickbyclick.ro", $to, $subject, $message);
It shows 500 error server. Can anyone please help me?
Edit: this is the emailShowNice function
function emailShowNice($message) {
$order = array('', '
', '
', "", "
", "
");
$replace = ' <br /> ';
$mes = str_replace($order, $replace, $message);
return $mes;
}