i am working in php. I have wriiten mail functionality using mailer extension of Yii framework with code as-
我在php工作。我使用Yii框架的邮件程序扩展和代码作为wriiten邮件功能 -
public function sendsecureEmail($FromEmail,$ToEmail,$Subject,$Message)
{
$settings=new Settings();
$mailer = Yii::createComponent('application.extensions.mailer.EMailer');
$mailer->IsSMTP();
$mailer->IsHTML(true);
$mailer->SMTPAuth = true;
$mailer->SMTPSecure = 'ssl';
$mailer->Host =$settings->Host;
$mailer->Port =$settings->Port;
$mailer->CharSet = 'UTF-8';
$mailer->Username =$FromEmail;
$mailer->Password =$settings->password;
$mailer->FromName = 'balaee.com';
// $mailer->AddAddress($ToEmail);
$mailer->Subject = $Subject;
$mailer->IsHTML(true);
$mailer->Body=$Message;
$mailer->AddCC($ToEmail);
// $mailer->AddBCC=;
if($mailer->Send())
{
echo "Mail send Successfully.Please you have check mail ";
}
else
{
echo "Fail to send your message!";
}
}
where $setting->$Host="mail.balaee.com",$setting->$Port=25. In php.ini file settings are as-
其中$ setting - > $ Host =“mail.balaee.com”,$ setting - > $ Port = 25。在php.ini文件中设置为 -
SMTP = mail.balaee.com
sendmail_from = noreply@balaee.com
smtp_port = 25
When i am trying to send mail its giving me error as-SMTP Error: Could not connect to SMTP host. So what addtional settings i needed to do
当我尝试发送邮件时,它给我的错误为 - SMTP错误:无法连接到SMTP主机。那么我需要做什么附加设置
1 个解决方案
#1
0
I had a similar error. Turned out the DNS settings went blank in centos after the server restarted. After setting them up everything stared working again. Hope it helps.
我有类似的错误。在服务器重新启动后,DNS设置在centos中显示为空白。设置好后,一切都盯着看了。希望能帮助到你。
#1
0
I had a similar error. Turned out the DNS settings went blank in centos after the server restarted. After setting them up everything stared working again. Hope it helps.
我有类似的错误。在服务器重新启动后,DNS设置在centos中显示为空白。设置好后,一切都盯着看了。希望能帮助到你。