SMTPDebug = 2; // Включить отладку //$send->Debugoutput = 'html'; $send->isSMTP(); $send->Host = 'mail.argumenti.ru'; $send->SMTPAuth = true; $send->CharSet = 'UTF-8'; $send->Username = 'klan@mail.argumenti.ru'; $send->Password = 'Adfhj789-jkhgk6F'; $send->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; $send->Port = 587; $send->setFrom('klan@mail.argumenti.ru', 'Аргументы Недели'); $send->addAddress($mail['mail'], $mail['mail']); if (isset($mail['html'])) { $send->isHTML(true); } else { $send->ContentType = 'text/plain'; $send->isHTML(false); } $send->Subject = $mail['subject']; $send->Body = $mail['message']; return $send->send(); } catch (Exception $e) { //echo "Ошибка отправки: {$e->getMessage()}"; echo '
К сожалению в данный момент письмо невозможно отправить.
Попробуйте позже.
'; } } function sendmail_old($config, $mail){ $send = new PHPMailer; $send->isSMTP(); //$send->SMTPDebug=3; // Set mailer to use SMTP $send->Host = $config['host']; // Specify main and backup SMTP servers $send->Username = $config['login']; // SMTP username $send->Password = $config['password']; if (isset($config['secure'])) { $send->SMTPSecure = $config['secure']; $send->SMTPAuth = true; } else { $send->SMTPSecure = false; $send->SMTPAutoTLS = false; } $send->Port = $config['port']; // TCP port to connect to $send->setFrom($config['login'], $config['name']); $send->addAddress($mail['mail'], $mail['mail']); // Add a recipient $send->CharSet = 'UTF-8'; if (isset($mail['html'])){ $send->isHTML(True); // Set email format to HTML } else { $send->ContentType = 'text/plain'; $send->isHTML(False); } $send->Subject = $mail['subject']; $send->Body = $mail['message']; return $send->send(); }