我从服务器收到此错误。我尝试在localhost发送电子邮件,没有,所有邮件都在发送。但是,当我在服务器上编码代码时,我有时间会有这个错误。这可以像垃圾邮件那样识别我的邮件。
Swift_TransportException
预期的响应代码250,但代码为“451”,消息为“451 Ten” 电子邮件zostal zaklasyfikowanu jako spam。 W przypadku pytan prosimy o kontakt z naszymi konsultantami na stronie http://kontakt.o2.pl/“
这是我的函数发送电子邮件:
public function getUser() {
$user = User::findOne([
'status' => User::STATUS_DELETED,
'email' => $this->email,
]);
return Url::to(['registration/confirm', 'key' => $user['auth_key']], true);
}
public function sendEmail() {
$status = Yii::$app->mailer->compose('registrationmail',['url' => $this->getUser()])
->setTo($this->email)
->setCharset('utf8')
->setFrom([\Yii::$app->params['supportEmail'] => \Yii::$app->params['supportEmail']])
->setSubject(self::SUBJECT)
->send();
return $status;
}
电子邮件的内容:
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $user common\models\User */
?>
<div class="wrapper" style="width:960px; margin:0 auto;">
<div class="header" style="background:url('img/bg_header.png'); min-height:84px;">
<div class="header-content" style="width:800px; margin:0 auto; padding-top:20px;">
<a class="logo" href="" style="display:block; width:310px; height:50px; background:url('img/logo.png') no-repeat;"></a>
</div>
</div>
<div class="content-wrapper" style="background:url('img/conteng-bg.png'); padding-bottom:10px;">
<div class="content" style="width:800px; margin:0 auto; padding-top:40px; color:#393838">
<h1 style="margin:0; font-size:24px;">xxxxxxxxx</h1>
<h2 style=" font-size:18px;">xxxxxxxx,</h2>
<p style="font-size:14px;">xxxxxxxxxxxxxxx:</p>
<p href="#" style="font-size:14px; color:#c69f61; font-family:Arial,Helvetica,sans-serif;"><?= Html::a(Html::encode($url), $url) ?></p>
<p style="font-size:12px; font-style:italic; margin:60px 0 50px 0;">xxxxxxxxxx</p>
<span style="display:block; border-top:1px solid #a1a1a1; border-bottom: 1px solid #a1a1a1; font-size:12px; text-align:center; pxxxxxxxxxx <a href="mailto:xxxxx@xxxxxx.pl" style="color:#c69f61; ">xxxxx@xxxxx.pl</a></span>
<p class="copyright" style="color:#807f7f; text-align:center; font-size:10px; margin-top:20px;">xxxxxxx © xxxxx 2016</p>
</div>
</div>
</div>
我写xxx我有一些数据。任何人都知道如何在服务器上解决这个问题?