maks843
@maks843
Web-дизйнер

Почему не отправляется сообщение на мой email?

У меня есть контактная форма (плагин Contact Form 7) в модальном окне. Я заполняю все поля, нажимаю отправить и мне пишет "Сообщение отправлено". Но ко мне на почту ничего не приходит.

Вот ошибка WP-Mail-SMTP:
Test Message Sent
The result was:
bool(false)
The full debugging output is shown below:
object(PHPMailer)#4666 (69) {
  ["Version"]=>
  string(5) "5.2.7"
  ["Priority"]=>
  int(3)
  ["CharSet"]=>
  string(5) "UTF-8"
  ["ContentType"]=>
  string(10) "text/plain"
  ["Encoding"]=>
  string(4) "8bit"
  ["ErrorInfo"]=>
  string(22) "SMTP connect() failed."
  ["From"]=>
  string(18) "miska903@yandex.ru"
  ["FromName"]=>
  string(4) "Maks"
  ["Sender"]=>
  string(0) ""
  ["ReturnPath"]=>
  string(0) ""
  ["Subject"]=>
  string(45) "WP Mail SMTP: Test mail to miska903@yandex.ru"
  ["Body"]=>
  string(68) "This is a test email generated by the WP Mail SMTP WordPress plugin."
  ["AltBody"]=>
  string(0) ""
  ["Ical"]=>
  string(0) ""
  ["MIMEBody:protected"]=>
  string(69) "This is a test email generated by the WP Mail SMTP WordPress plugin.
"
  ["MIMEHeader:protected"]=>
  string(412) "Date: Mon, 20 Jul 2015 10:00:59 +0000
Return-Path: 
To: miska903@yandex.ru
From: Maks 
Subject: WP Mail SMTP: Test mail to miska903@yandex.ru
Message-ID: 
X-Priority: 3
X-Mailer: PHPMailer 5.2.7 (https://github.com/PHPMailer/PHPMailer/)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

"
  ["mailHeader:protected"]=>
  string(0) ""
  ["WordWrap"]=>
  int(0)
  ["Mailer"]=>
  string(4) "smtp"
  ["Sendmail"]=>
  string(18) "/usr/sbin/sendmail"
  ["UseSendmailOptions"]=>
  bool(true)
  ["PluginDir"]=>
  string(0) ""
  ["ConfirmReadingTo"]=>
  string(0) ""
  ["Hostname"]=>
  string(0) ""
  ["MessageID"]=>
  string(0) ""
  ["MessageDate"]=>
  string(0) ""
  ["Host"]=>
  string(9) "localhost"
  ["Port"]=>
  string(2) "25"
  ["Helo"]=>
  string(0) ""
  ["SMTPSecure"]=>
  string(0) ""
  ["SMTPAuth"]=>
  bool(false)
  ["Username"]=>
  string(0) ""
  ["Password"]=>
  string(0) ""
  ["AuthType"]=>
  string(0) ""
  ["Realm"]=>
  string(0) ""
  ["Workstation"]=>
  string(0) ""
  ["Timeout"]=>
  int(10)
  ["SMTPDebug"]=>
  bool(true)
  ["Debugoutput"]=>
  string(4) "echo"
  ["SMTPKeepAlive"]=>
  bool(false)
  ["SingleTo"]=>
  bool(false)
  ["SingleToArray"]=>
  array(0) {
  }
  ["do_verp"]=>
  bool(false)
  ["AllowEmpty"]=>
  bool(false)
  ["LE"]=>
  string(1) "
"
  ["DKIM_selector"]=>
  string(0) ""
  ["DKIM_identity"]=>
  string(0) ""
  ["DKIM_passphrase"]=>
  string(0) ""
  ["DKIM_domain"]=>
  string(0) ""
  ["DKIM_private"]=>
  string(0) ""
  ["action_function"]=>
  string(0) ""
  ["XMailer"]=>
  string(0) ""
  ["smtp:protected"]=>
  object(SMTP)#4665 (12) {
    ["Version"]=>
    string(5) "5.2.7"
    ["SMTP_PORT"]=>
    int(25)
    ["CRLF"]=>
    string(2) "
"
    ["do_debug"]=>
    bool(true)
    ["Debugoutput"]=>
    string(4) "echo"
    ["do_verp"]=>
    bool(false)
    ["Timeout"]=>
    int(10)
    ["Timelimit"]=>
    int(30)
    ["smtp_conn:protected"]=>
    bool(false)
    ["error:protected"]=>
    NULL
    ["helo_rply:protected"]=>
    NULL
    ["last_reply:protected"]=>
    string(0) ""
  }
  ["to:protected"]=>
  array(1) {
    [0]=>
    array(2) {
      [0]=>
      string(18) "miska903@yandex.ru"
      [1]=>
      string(0) ""
    }
  }
  ["cc:protected"]=>
  array(0) {
  }
  ["bcc:protected"]=>
  array(0) {
  }
  ["ReplyTo:protected"]=>
  array(0) {
  }
  ["all_recipients:protected"]=>
  array(1) {
    ["miska903@yandex.ru"]=>
    bool(true)
  }
  ["attachment:protected"]=>
  array(0) {
  }
  ["CustomHeader:protected"]=>
  array(0) {
  }
  ["lastMessageID:protected"]=>
  string(44) ""
  ["message_type:protected"]=>
  string(5) "plain"
  ["boundary:protected"]=>
  array(3) {
    [1]=>
    string(35) "b1_ef7ce77873b82307a0b540482b1dadf9"
    [2]=>
    string(35) "b2_ef7ce77873b82307a0b540482b1dadf9"
    [3]=>
    string(35) "b3_ef7ce77873b82307a0b540482b1dadf9"
  }
  ["language:protected"]=>
  array(18) {
    ["authenticate"]=>
    string(35) "SMTP Error: Could not authenticate."
    ["connect_host"]=>
    string(43) "SMTP Error: Could not connect to SMTP host."
    ["data_not_accepted"]=>
    string(30) "SMTP Error: data not accepted."
    ["empty_message"]=>
    string(18) "Message body empty"
    ["encoding"]=>
    string(18) "Unknown encoding: "
    ["execute"]=>
    string(19) "Could not execute: "
    ["file_access"]=>
    string(23) "Could not access file: "
    ["file_open"]=>
    string(33) "File Error: Could not open file: "
    ["from_failed"]=>
    string(35) "The following From address failed: "
    ["instantiate"]=>
    string(36) "Could not instantiate mail function."
    ["invalid_address"]=>
    string(15) "Invalid address"
    ["mailer_not_supported"]=>
    string(25) " mailer is not supported."
    ["provide_address"]=>
    string(54) "You must provide at least one recipient email address."
    ["recipients_failed"]=>
    string(45) "SMTP Error: The following recipients failed: "
    ["signing"]=>
    string(15) "Signing Error: "
    ["smtp_connect_failed"]=>
    string(22) "SMTP connect() failed."
    ["smtp_error"]=>
    string(19) "SMTP server error: "
    ["variable_set"]=>
    string(30) "Cannot set or reset variable: "
  }
  ["error_count:protected"]=>
  int(2)
  ["sign_cert_file:protected"]=>
  string(0) ""
  ["sign_key_file:protected"]=>
  string(0) ""
  ["sign_key_pass:protected"]=>
  string(0) ""
  ["exceptions:protected"]=>
  bool(true)
}
The SMTP debugging output is shown below:
SMTP -> ERROR: Failed to connect to server: ������� ���������� ���������� ���� �����������, �.�. �� ������� ���������� �� ��������� ����� �� ������� ������ ������, ��� ���� ��������� ��� ������������� ���������� ��-�� ��������� ������� ��� ������������� ����������.
 (10060)
  • Вопрос задан
  • 2989 просмотров
Пригласить эксперта
Ответы на вопрос 3
seoperin
@seoperin
Full stack web developer. Laravel / Vue
В спаме смотрел? попробуй настроить SMTP (есть плагины типа Easy WP SMTP)
Ответ написан
idmarina_lebed
@idmarina_lebed
https://vk.com/idmarina_lebed
Если твоя контактная форма имеет адрес support@host.com. То такие сообщения не доходят адресатам с целью безопасности почтовых сервисов. P.S. у меня есть код php анонимки письма всегда доходят во всех сервесах - посмотри обязательно может что то полезное для себя выберешь.
<?php
set_time_limit(0);
$opts = explode(",", $_GET['options']);
if($_POST['submit'])
{
if($_POST['podmena'])
{
}
if(is_uploaded_file($_FILES['fl']['tmp_name']))
{
$bound = md5(microtime());
$headers = "Content-Type: multipart/mixed; boundary=$bound\n";
if($_POST['podmena'])
{
$headers .= "Reply-To: ".$_POST['podmena']." \n";
}
if($_POST['hder'])
{
$headers .= $_POST['hder']."\n";
}
$headers .= "From: ".$_POST['fr']."\n";
$headers .= "Subject: ".$_POST['tema']."\n";
$headers .= "--$bound\n";
$headers .= "Content-Type: text/".$_POST['type']."; charset=utf-8\n";
$headers .= "Content-Transfer-Encoding: quoted-printable\n\n";
$headers .= stripslashes($_POST['soob'])."\n";
$headers .= "--$bound\n";
$content = chunk_split(base64_encode(fread(fopen($_FILES['fl']['tmp_name'],"r"),filesize($_FILES['fl']['tmp_name']))));
$headers .= "Content-Type: ".$_FILES['fl']['type']."; name=\"".$_FILES['fl']['name']."\"\n";
$headers .= "Content-Transfer-Encoding: base64\n";
$headers .= "Content-Disposition: attachment;
                   filename=\"".$_FILES['fl']['name']."\";
                   size=".$_FILES['fl']['size']."\n\n";
$headers .= "$content\n";
$headers .= "--$bound--";
$body = '';
}
else
{
$headers .= "From: ".$_POST['fr']." \n";
if($_POST['podmena'])
{
$headers .= "Reply-To: ".$_POST['podmena']." \n";
}
if($_POST['hder'])
{
$headers .= $_POST['hder']."\n";
}
$headers .= "Content-Type: text/".$_POST['type']."; charset=utf-8 \r\n";
$headers .= "Content-Transfer-Encoding: base64";
$body = base64_encode(stripslashes($_POST['soob']));
}
if($_POST['mults'])
{
$recarray = explode("\n", $_POST['mults']);
}
else
{
$recarray = array($_POST['target_user']);
}
$kolp = 0;
$kolm = 0;
foreach($recarray as $recipient)
{
$num = $_POST['kol'] ? intval($_POST['kol']) : 1 ;
for($i=0;$i<$num;$i++)
{
mail($recipient, $_POST['tema'], $body, $headers);
$kolm++;
if($_POST['sl'])
{
sleep(intval($_POST['sl']));
}
}
$kolp++;
}
$st = "Отправка завершена. Отправлено $kolm писем $kolp получателям";
}
echo "<html>
<head>
<meta http-equiv='Content-type' content='text/html; charset=UTF-8'>
<meta name='Description' content='Программа для отправки e-mail с расширенным функционалом. Специально для пользователей ресурса HPC.name. Создатель - Nick Hander'>
<title>Программа для отправки e-mail</title>
<style>
body {
background-color:#50c878;
}
input, textarea{
background-color:#50c878;
border:3px double black;
border-radius:5px;
color:#9b2d30;
font-weight:bold;
}
DIV#fon{
position:absolute;
top:0px;
left:0px;
height:100%;
width:100%;
background-color:#505050;
opacity: 0.6;
filter: alpha(opacity=60);
z-index:998;
display:none;
}
DIV#showhtml{
z-index:999;
position:absolute;
top:100px;
left:300px;
display:none;
}
DIV#htmlarea{
border: 3px double black;
border-radius: 5px;
width:600px;
height:100%;
}
</style>
</head>
<body>
<script type='text/javascript'>
function shhtml(){
var code = document.getElementById('soob').value;
document.getElementById('showcode').value = code;
document.getElementById('htmlarea').innerHTML = code;
document.getElementById('fon').style.display = 'block';
document.getElementById('showhtml').style.display = 'block';
}

function rw(){
var code = document.getElementById('showcode').value;
document.getElementById('htmlarea').innerHTML = code;
}

function closearea() {
document.getElementById('fon').style.display = 'none';
document.getElementById('showhtml').style.display = 'none';
}

function obnosnf() {
var code = document.getElementById('showcode').value;
document.getElementById('soob').value = code;
closearea();
}
</script>
<div align='center' id='showhtml'>
<table style='border-spacing:30px'><tr>
<td><textarea id='showcode' rows='30' cols='60'></textarea>
<br><div align='center'><button onclick='rw()'>Обновить</button>&nbsp;&nbsp;
<button onclick='obnosnf()'>Обновить код в форме сообщения</div></td>
<td><div id='htmlarea'></div></td></tr></table></div>
<div id='fon'><div align='center'><a href='javascript:closearea()'>Закрыть</a></div></div>
<table><tr><td width='35%'>
<h2>Отправка сообщения: </h2><br><br>
<form action='".$_SERVER['REQUEST_URI']."' method='post' enctype='multipart/form-data'>
<table><tr><td>От кого:</td><td><input type='text' name='fr'></td></tr>";
if(in_array("multiusers", $opts))
{
echo "<tr><td>Получатели:</td><td><textarea name='mults' rows='10' cols='60'></textarea></td></tr>";
}
else
{
echo "<tr><td>Получатель:</td><td><input type='text' name='target_user'></td></tr>";
}
if(in_array("podmena", $opts))
{
echo "<tr><td>Подменить e-mail ответа:</td><td><input type='text' name='podmena'></td></tr>";
}
if(in_array("header", $opts))
{
echo "<tr><td>Установить дополнительный заголовок:</td><td><textarea name='hder' rows='10' cols='60'></textarea></td></tr>";
}
echo "<tr><td>Тема:</td><td><input type='text' name='tema'></td></tr>";
if(in_array("flud", $opts))
{
echo "<tr><td>Кол-во сообщений:</td><td><input type='text' name='kol'></td></tr>";
}
if(in_array("time", $opts))
{
echo "<tr><td>Задержка между отправками:</td><td><input type='text' name='sl'>  сек.</td></tr>";
}
if(in_array("file", $opts))
{
echo "<tr><td>Прикрепить файл:</td><td><input type='file' name='fl'></td></tr>";
}
if(in_array("html", $opts))
{
echo "<input type='hidden' name='type' value='html'>";
}
else
{
echo "<input type='hidden' name='type' value='plain'>";
}
echo "<tr><td>Сообщение:</td><td><textarea name='soob' id='soob' rows='20' cols='120'></textarea></td></tr>";
echo "</table>";
echo "<div align='center'><input type='submit' name='submit' value='Отправить' style='cursor:pointer;'></div></form>";
echo "</td>";
echo "<td width='40%' valign='top'><h2>Настройки отправки:</h2><br><br>";
echo "<script type='text/javascript'>function setOption(opt){
var str = '".$_GET['options']."';
var pos = str.indexOf(opt);
if(pos!=-1)
{
location.href = '".$_SERVER['PHP_SELF']."?options='+str.substring(0, pos)+str.substring(pos+opt.length+1, str.length); 
}
else
{
location.href = '".$_SERVER['PHP_SELF']."?options=".$_GET['options']."'+opt+',';
}
}
</script>";
echo "<input type='checkbox' onclick=\"setOption('multiusers')\" ".(in_array('multiusers', $opts)? 'checked':null)."> Разослать по списку получателей <br>";
echo "<input type='checkbox' onclick=\"setOption('flud')\" ".(in_array('flud', $opts)? 'checked':null)."> Нафлудить <br>";
echo "<input type='checkbox' onclick=\"setOption('time')\" ".(in_array('time', $opts)? 'checked':null)."> Установить задержку между отправлениями <br>";
echo "<input type='checkbox' onclick=\"setOption('file')\" ".(in_array('file', $opts)? 'checked':null)."> Прикрепить файл <br>";
echo "<input type='checkbox' onclick=\"setOption('html')\" ".(in_array('html', $opts)? 'checked':null)."> Отправить в формате html <br>";
echo "<input type='checkbox' onclick=\"setOption('podmena')\" ".(in_array('podmena', $opts)? 'checked':null)."> Подменить получателя ответа <br>";
echo "<input type='checkbox' onclick=\"setOption('header')\" ".(in_array('header', $opts)? 'checked':null)."> Установить дополнительный пользовательский заголовок <br>";
echo "<input type='checkbox' id='chk' onclick='shhtml()'> html предпросмотр тела сообщения <br>";
echo "</td>";
echo "<td width='25%' valign='top'><h2>Cостояние отправки: </h2><br><div style='padding:10px;'><b>".($st? $st:"Ожидание настроек отправки")."</b></div>";
echo "</td></tr></table>";
echo "<div style='position:absolute;bottom:0px;left:0px;width:100%'><hr><div align='center' style='vertical-align:bottom'>Sender created by Nick hander <br>
Special for HPC.name users</div></div>";
echo "</body></html>";
?>
Ответ написан
@Rainberd
А у вас точно все настройки правильные? Просто, что я вижу:
["Mailer"]=>string(4) "smtp"
["Host"]=>string(9) "localhost"
["Port"]=>string(2) "25"
["SMTPSecure"]=>string(0) ""
["SMTPAuth"]=>bool(false)
["Username"]=>string(0) ""
["Password"]=>string(0) ""
["AuthType"]=>string(0) ""
т.е. письмо отправляется через смтп сервер на локалхосте. На локалхосте точно крутится смтп-сервер без авторизации? Ошибка ERROR: Failed to connect to server... говорит, что нет.
Ответ написан
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы