Codeigniter 和 Amazon SES:错误 554

Codeigniter and Amazon SES : error 554

我正在尝试使用 Code Igniter 和 Amazon SES 作为 smtp 服务器发送电子邮件。 这是我使用的代码:

public function test_mail()
{
    $this->load->library('email');
    $config = array(
        'protocol' => 'smtp',
        'smtp_host' => 'email-smtp.eu-west-1.amazonaws.com',
        'smtp_user' => 'my_smtp_user',
        'smtp_pass' => 'my_smtp_pass',
        'smtp_port' => 587,
        'mailtype' => 'html',
        'smtp_crypto'  => 'tls'
    );

    $this->email->initialize($config);

    $this->email->set_newline("\r\n");
    $this->email->from('verified@email.com', 'Test From');
    $this->email->to('my_email@email.com', 'Test To');
    $this->email->subject('Test');
    $this->email->message('test');

    $this->email->send();

    var_dump($this->email->print_debugger());
}

简单的代码,但不起作用。

我也试了很多host/port组合都没有成功:(

这是 var_dump 结果:

220 email-smtp.amazonaws.com ESMTP SimpleEmailService-1207641145 

hello: 250-email-smtp.amazonaws.com
250-8BITMIME
250-SIZE 10485760
250-STARTTLS
250-AUTH PLAIN LOGIN
250 Ok

starttls: 220 Ready to start TLS

hello: 250-email-smtp.amazonaws.com
250-8BITMIME
250-SIZE 10485760
250-STARTTLS
250-AUTH PLAIN LOGIN
250 Ok

from: 250 Ok

to: 250 Ok

data: 354 End data with .

554 Message rejected: Email address is not verified.
The following SMTP error was encountered: 554 Message rejected: Email address is not verified.
Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.

User-Agent: CodeIgniter
Date: Thu, 12 Nov 2015 07:57:17 +0000
From: "Test From" <verified@email.com>
Return-Path: <verified@email.com>
To: my_email@email.com
Subject: Test
Reply-To: "verified@email.com" <verified@email.com>
X-Sender: verified@email.com
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <5644465d8dad1@email.com>
Mime-Version: 1.0


Content-Type: multipart/alternative; boundary="B_ALT_5644465d8db88"

This is a multi-part message in MIME format.
Your email application may not support this format.

--B_ALT_5644465d8db88
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

test


--B_ALT_5644465d8db88
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

test

--B_ALT_5644465d8db88--

当然,在写这个问题之前,我和我负责SES的同事核实过"from email"是否真的得到了验证。它是:

我不知道要看什么或在哪里看..

谢谢:)

发生此错误是因为 SES 在沙盒中。在 Sandbox 中时,必须验证发件人和收件人的电子邮件,而不仅仅是发件人。