Php 托管网站时出现Mandrill SMTP错误
我在SMTP中使用了Mandrill,下面的代码在localhost中运行良好。但当我在remote中托管我的网站时,同样的代码不起作用 它显示一个错误 Smtp->服务器535不接受错误密码。验证数据不正确 这是我的密码。请帮帮我Php 托管网站时出现Mandrill SMTP错误,php,email,yii,smtp,mandrill,Php,Email,Yii,Smtp,Mandrill,我在SMTP中使用了Mandrill,下面的代码在localhost中运行良好。但当我在remote中托管我的网站时,同样的代码不起作用 它显示一个错误 Smtp->服务器535不接受错误密码。验证数据不正确 这是我的密码。请帮帮我 public function actionCreate() { $model=new Contacts; if(isset($_POST['Contacts'])) { $model->attributes=$_POS
public function actionCreate()
{
$model=new Contacts;
if(isset($_POST['Contacts']))
{
$model->attributes=$_POST['Contacts'];
Yii::import('application.extensions.phpmailer.JPhpMailer');
$mail = new JPhpMailer;
$mail->IsSMTP();
$mail->Host = 'smtp.mandrillapp.com';
$mail->Port ='587';
$mail->SMTPAuth = true;
$mail->SMTPSecure="tls";
$mail->Username = 'xxx@gmail.com';
$mail->SMTPDebug = 1;
$mail->SMTPKeepAlive =true;
$mail->Password = 'tshb-mA19EdIvdQf2mO8KA';
$mail->SetFrom($_POST['Contacts']['email'], $_POST['Contacts']['email']);
$mail->Subject = 'New Mail Receiverd';
$mail->AltBody = 'To view the message, please use an HTML compatible email viewer!';
$mail->MsgHTML("DASDSAD");
$msgBody="<div><ul>";
foreach($model->attributes as $key=>$value)
{
$msgBody.="<li>".$key." - ".$value."</li>";
}
$msgBody.="</ul></div>";
$mail->MsgHTML($msgBody);
$mail->AddAddress('xxx@gmail.com', 'xxx');
$ret=$mail->Send();
if($model->save())
print "<script type=\"text/javascript\">";
print "alert('Thank you for contacting us.')";
print "</script>";
}
$this->render('create',array(
'model'=>$model,
));
}
公共函数actionCreate()
{
$model=新联系人;
如果(isset($_POST['Contacts']))
{
$model->attributes=$\u POST['Contacts'];
Yii::import('application.extensions.phpmailer.JPhpMailer');
$mail=新的JPhpMailer;
$mail->IsSMTP();
$mail->Host='smtp.mandrillapp.com';
$mail->Port='587';
$mail->SMTPAuth=true;
$mail->SMTPSecure=“tls”;
$mail->Username=xxx@gmail.com';
$mail->SMTPDebug=1;
$mail->SMTPKeepAlive=true;
$mail->Password='tshb-mA19EdIvdQf2mO8KA';
$mail->SetFrom($\u POST['Contacts']['email'],$\u POST['Contacts']['email']);
$mail->Subject='新邮件已接收';
$mail->AltBody='要查看邮件,请使用与HTML兼容的电子邮件查看器!';
$mail->MsgHTML(“DASDSAD”);
$msgBody=“”;
foreach($model->attributes as$key=>$value)
{
$msgBody.=“- ”$key.-“$value.”
”;
}
$msgBody.=“
”;
$mail->MsgHTML($msgBody);
$mail->AddAddress('xxx@gmail.com","xxx",;
$ret=$mail->Send();
如果($model->save())
打印“”;
打印“警报('感谢您联系我们')”;
打印“”;
}
$this->render('create',数组(
'model'=>$model,
));
}
最常见的原因是您使用的共享主机提供程序正在重定向SMTP连接,或者不允许外部SMTP连接
因此,您可能正在连接无法识别您的Mandrill凭据的本地邮件服务器,而不是连接到smtp.mandrillapp.com。我们有一些建议,建议您继续努力,以确保您按预期进行连接
如果您仍然看到问题,您也可以通过单击Mandrill帐户左下角的“支持”按钮直接与支持部门联系 请不要发布同一问题的副本