I have this error from server. I try to send email in localhost and there is all right, all mail was sending. But when i upolad code on serwer i have this error time to time. This recognize my mail like Spam.
Swift_TransportException
Expected response code 250 but got code "451", with message "451 Ten e-mail zostal zaklasyfikowanu jako spam. W przypadku pytan prosimy o kontakt z naszymi konsultantami na stronie http://kontakt.o2.pl/ "
Here is my function send email:
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;
}
And content of email:
<?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>
I write xxx where i have some data. Anyone know how to resolve this erron on server?
\\Yii::$app->params['supportEmail']
应包含您对http://poczta.o2.pl/的用户名
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.