Question
Very long it works out a script to send an email using the PhpMailer
Help me please! When sending email messages php script in the browser worked through about 2 minutes, but all messages are delivered.
there are no errors on other SMTP servers is the same
PHP code
date_default_timezone_set('Europe/Kiev');
require_once($_SERVER['DOCUMENT_ROOT'].'/engine/phpmailer/PHPMailerAutoload.php');
$mail = new PHPMailer;
$mail->isSMTP();
//хост
$mail->Host = 'smtp.mail.ru';
$mail->SMTPAuth = true;
$mail->Username = 'admin@example.com';
$mail->Password = '********';
$mail->SMTPSecure = 'ssl';
$mail->Port = '465';
$mail->debug = true;
$mail->CharSet = 'UTF-8';
$mail->From = 'admin@example.com';
$mail->FromName = 'Админ';
$mail->addAddress('mail@example.com');
$mail->isHTML(true);
$mail->Subject = 'Тест Темы письма';
$mail->Body = 'тестовый текс Текст можно с хтмл';
if( $mail->send() ){
echo 'Письмо отправлено';
}else{
echo 'Письмо не может быть отправлено. ';
echo 'Ошибка: ' . $mail->ErrorInfo;
}
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×