I am using PHPMailer
using SMTP
to send Email. I have set everything.
But in the last I am getting error :
Mailer Error: The following From address failed: Email Address : Called Mail() without being connected
I came to know to set Order of coding, I also did it but still same error. Please help me to solve this issue.
My Code :
<?php
require 'PHPMailer.php';
error_reporting(E_ALL);
ini_set('display_errors', '1');
$name = $_POST["name"];
$email = $_POST["email"];
$subject = $_POST["subject"];
$message = $_POST["message"];
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Host = "smtp.live.com";
$mail->Port = 587;
$mail->SMTPAuth = true;
$mail->Username = "example@outlook.com";
$mail->Password = "password";
$mail->SMTPSecure = 'tls';
$mail->From = "info@neelcomputech.com";
$mail->FromName = $name;
$mail->AddAddress("info@neelcomputech.com");
$mail->IsHTML(true);
$mail->Subject = $subject;
$mail->Body = $mail_body = "<html> <body>";
$mail_body = "<b>Hello Admin,</b><br><br>You have got email from your website.<br><br>";
$mail_body .= '<table style="" cellpadding="3">';
$mail_body .= "
<tr>
<td width='50'> <strong> Name </strong> </td>
<td width='5'> : </td>
<td> $name </td>
</tr>
<tr>
<td> <strong> Email </strong> </td>
<td> : </td>
<td> $email </td>
</tr>
<tr>
<td> <strong> Message </strong> </td>
<td> : </td>
<td> $message </td>
</tr>
</table>
</body> </html>";
if(!$mail->Send())
{
echo 'Mailer Error: ' . $mail->ErrorInfo;
}
else
{
echo 'success';
}
?>
asked May 21, 2014 at 7:07
Jeeten ParmarJeeten Parmar
5,46815 gold badges62 silver badges111 bronze badges
<?php
require 'PHPMailer.php';
error_reporting(E_ALL);
ini_set('display_errors', '1');
$name = $_POST["name"];
$email = $_POST["email"];
$subject = $_POST["subject"];
$message = $_POST["message"];
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Host = "smtp.neelcomputech.com"; // Your SMTP PArameter
$mail->Port = 587; // Your Outgoing Port
$mail->SMTPAuth = true; // This Must Be True
$mail->Username = "info@neelcomputech.com"; // Your Email Address
$mail->Password = "YOUR PASSWORD"; // Your Password
$mail->SMTPSecure = 'tls'; // Check Your Server's Connections for TLS or SSL
$mail->From = "info@neelcomputech.com";
$mail->FromName = $name;
$mail->AddAddress("info@neelcomputech.com");
$mail->IsHTML(true);
$mail->Subject = $subject;
$mail->Body = $mail_body = "<html> <body>";
$mail_body = "<b>Hello Admin,</b><br><br>You have got email from your website.<br><br>";
$mail_body .= '<table style="" cellpadding="3">';
$mail_body .= "
<tr>
<td width='50'> <strong> Name </strong> </td>
<td width='5'> : </td>
<td> $name </td>
</tr>
<tr>
<td> <strong> Email </strong> </td>
<td> : </td>
<td> $email </td>
</tr>
<tr>
<td> <strong> Message </strong> </td>
<td> : </td>
<td> $message </td>
</tr>
</table>
</body> </html>";
if(!$mail->Send())
{
echo 'Mailer Error: ' . $mail->ErrorInfo;
}
else
{
echo 'success';
}
?>
You have to use your own parameters, in your smtp authentication.
Also you can check other mail server’s smtp parameters on PHPMailer’s Website:
phpmailer.worxware.com/index.php?pg=tip_srvrs
answered May 21, 2014 at 7:17
HddnTHAHddnTHA
1,0413 gold badges19 silver badges38 bronze badges
0
You could resolve this by using the following code:
$mail->Host = 'relay-hosting.secureserver.net';
Kitson88
2,8595 gold badges21 silver badges37 bronze badges
answered Jan 18, 2017 at 12:57
surajsuraj
3264 silver badges6 bronze badges
It took me a lot of digging to figure out the CentOS 7 disables SMTP connections by default, and its not through Firewalld.
Try running these lines if you run into this » Mailer Error: The following From address failed: » and «Called Mail() without being connected.»
sudo setsebool -P httpd_can_sendmail 1
sudo setsebool -P httpd_can_network_connect 1
Thanks to the following web article:
https://gistpages.com/posts/phpmailer_smtp_error_failed_to_connect_to_server_permission_denied_13_fix
answered Mar 16, 2018 at 15:54
DonzoDonzo
1791 silver badge5 bronze badges
Загрузка…
вообще то использую это расширение www.yiiframework.com/extension/smtp-mail/#hh0
но думаю суть у них общая
config
'components' => array(
'Smtpmail'=>array(
'class'=>'application.extensions.smtpmail.PHPMailer',
'Host'=>"myfactory.mail.ru",
'Username'=>'',
'Password'=>'',
'Mailer'=>'smtp',
'Port'=>25,
'SMTPAuth'=>false,
'SMTPDebug' => 1,
),
контролер
public static function mailsend($to,$from,$subject,$message){
$mail=Yii::app()->Smtpmail;
$mail->SetFrom($from, 'From NAme');
$mail->Subject = $subject;
$mail->MsgHTML($message);
$mail->AddAddress($to, "");
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
}else {
echo "Message sent!";
}
$mail->ClearAddresses();
}
public function actionContact()
{
\\
SiteController::mailsend(Yii::app()->params['adminEmail'],$model->name,'test',$model->body);
Invalid address: adminSMTP -> ERROR: Failed to connect to server: php_network_getaddresses: getaddrinfo failed: ����������� ��� �����, �� ������ ������������ ���� �� �������. (0)
The following From address failed: root@localhost : Called Mail() without being connected Mailer Error: The following From address failed: root@localhost : Called Mail() without being connected
обязательно ли указывать логинпас?
-
Помощь -
Хостинг -
Настройка почты на хостинге -
Проблемы -
При попытке отправить сообщение приходит отбойник
При попытке отправить сообщение приходит отбойник
Текст в начале отбойника:
This message was created automatically by mail delivery software.
A message that you sent could not be delivered to one or more of its
recipients. This is a permanent error. The following address(es) failed:
означает, что отправка сообщения не удалась из-за определённой ошибки. После этого идёт e-mail и сама ошибка:
- Recipient address rejected: User unknown in relay recipient table — Решение проблемы;
- Our system has detected that this message is
550-5.7.1 likely unsolicited mail. To reduce the amount of spam sent to Gmail,
550-5.7.1 this message has been blocked. Please visit… — ошибка говорит о том, что ваше сообщение распознано принимающей стороной как спам. В данном случае вам необходимо обратиться к принимающей стороне и выяснить причину проблемы; - SMTP error from remote mail server after end of data:
host mxs.mail.ru [217.69.139.150]: 550 spam message rejected… — аналогично ошибке выше принимающая стороны пометила ваше сообщение как спам. В данном случае вам необходимо обратиться в Mail.Ru для выяснения причин; - 550 Message was not accepted — it contains invalid headers. More specially, ‘From:’ header must match user you are sending mail from — проблема встречается при отправке сообщение на Mail.Ru. Решение проблемы.
PTR-запись
Для корректной работы почты мы также рекомендуем настроить PTR-запись по инструкции.
Спасибо за оценку!
Как мы можем улучшить статью?
Нужна помощь?
Напишите в службу поддержки!
Stallone 0 / 0 / 0 Регистрация: 08.07.2012 Сообщений: 54 |
||||
1 |
||||
05.10.2015, 20:33. Показов 8531. Ответов 7 Метки нет (Все метки)
Здравствуйте.
Ошибка. Заранее спасибо.
0 |
Programming Эксперт 94731 / 64177 / 26122 Регистрация: 12.04.2006 Сообщений: 116,782 |
05.10.2015, 20:33 |
Ответы с готовыми решениями:
PHPmailer Настройка PHPMailer Установка PHPMailer 7 |
Laroux 172 / 167 / 75 Регистрация: 21.11.2014 Сообщений: 1,490 |
||||
05.10.2015, 21:08 |
2 |
|||
ну и надо понять, не включена ли у Вас на этой почте двойная аутентификация. Проверьте на всякий. И отключите, если включена
0 |
3827 / 3178 / 1334 Регистрация: 01.08.2012 Сообщений: 10,770 |
|
05.10.2015, 21:16 |
3 |
А в аккаунте включили доступ по SMTP? Если нет, см. здесь 1-ый пункт.
1 |
0 / 0 / 0 Регистрация: 08.07.2012 Сообщений: 54 |
|
05.10.2015, 21:28 [ТС] |
4 |
Laroux, Jodah,
0 |
172 / 167 / 75 Регистрация: 21.11.2014 Сообщений: 1,490 |
|
05.10.2015, 21:42 |
5 |
в гугде несколько ссылок говорят вот об этом
0 |
0 / 0 / 0 Регистрация: 08.07.2012 Сообщений: 54 |
|
05.10.2015, 21:53 [ТС] |
6 |
Laroux,
0 |
172 / 167 / 75 Регистрация: 21.11.2014 Сообщений: 1,490 |
|
05.10.2015, 21:58 |
7 |
не, не.. в этом проблема. Я почти уверен (сразу ошибку не вычитал). Внимательнее посмотрите.
1 |
0 / 0 / 0 Регистрация: 08.07.2012 Сообщений: 54 |
|
05.10.2015, 22:51 [ТС] |
8 |
Проблема решена. Всем спасибо за помощь.
0 |