SMTPDebug = SMTP::DEBUG_SERVER; //Enable verbose debug output $mail->isSMTP(); //Send using SMTP $mail->Host = '172.16.1.3'; //Set the SMTP server to send through $mail->SMTPAuth = false; //Enable SMTP authentication //$mail->Username = 'user@example.com'; //SMTP username //$mail->Password = 'secret'; //SMTP password $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; //Enable implicit TLS encryption $mail->Port = 465; //TCP port to connect to; use 587 if you have set `SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS` //Recipients $mail->setFrom('coe@nasledstvo.bg', 'Mailer'); $mail->addAddress($email, 'Heritage BG'); //Add a recipient //$mail->addAddress('ellen@example.com'); //Name is optional //$mail->addReplyTo('info@example.com', 'Information'); //$mail->addCC('cc@example.com'); //$mail->addBCC('bcc@example.com'); //Attachments //$mail->addAttachment('/var/tmp/file.tar.gz'); //Add attachments //$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); //Optional name //Content $mail->isHTML(true); //Set email format to HTML $mail->Subject = $subject; $mail->Body = $body; $mail->AltBody = strip_tags($body); $mail->send(); echo 'Message has been sent'; exit; } catch (Exception $e) { echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}"; exit; }*/ //ini_set("SMTP", "172.16.1.3"); //ini_set("sendmail_from", "coe@nasledstvo.bg"); //ini_set("smtp_port", "25"); // The message $message = "This is a test email"; $subject = "Heritage BG"; $headers = "From: coe@nasledstvo.bg"; $email = "mdkrustev@gmail.com"; //mail($email, $subject, $message, $headers); } public static function mailer($email, $sendEmail, $body, $subject) { if ($sendEmail) { $headers = 'Content-type: text/html; charset=UTF-8' . "\r\n"; $headers .= 'From: ' . $email . "\r\n"; $headers .= 'Reply-To: ' . $email . "\r\n"; $headers .= 'X-Mailer: PHP/' . phpversion(); $headers .= "X-Priority: 3\r\n"; if (is_array($sendEmail)) { foreach ($sendEmail as $to) $headers .= 'Cc: ' . $to . "\r\n"; } else { $headers .= 'Cc: ' . $sendEmail . "\r\n"; } } try { mail($to, 'Re: ' . $subject, $body, $headers); } catch (\Exception $exception) { die('Message not sent'); } } }