i am working in php. I have wriiten mail functionality using mailer extension of Yii framework with code as-
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-
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
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.