【问题标题】:Swift_TransportException with code 451 on server sideSwift_TransportException,服务器端代码为 451
【发布时间】:2016-05-17 20:48:06
【问题描述】:

我从服务器收到此错误。我尝试在 localhost 中发送电子邮件,一切正常,所有邮件都在发送。但是当我在 serwer 上上传代码时,我有时会遇到这个错误。这会像垃圾邮件一样识别我的邮件。

Swift_TransportException

预期响应代码 250,但得到代码“451”,消息“451 十 电子邮件 zostal zaklasyfikowanu jako 垃圾邮件。 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。有人知道如何解决服务器上的这个错误吗?

【问题讨论】:

    标签: php email server yii2


    【解决方案1】:

    \Yii::$app-&gt;params['supportEmail'] 应包含您的用户名http://poczta.o2.pl/

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-10-10
      • 1970-01-01
      • 2016-12-10
      • 2017-06-29
      • 1970-01-01
      • 2021-04-03
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多