Yii2 Basic - 我如何设置配置以使用 ec2 亚马逊服务器 SES 和 SwiftMailer 发送邮件

Yii2 Basic - How I set config for send mail using ec2 amazon server SES and SwiftMailer

实际上,我首先使用的是 Gmail SMTP。最近我将我的代码转移到 ec2 aws 上,但似乎没有电子邮件功能 working.please 详细解释如何在 Yii2 中使用 SES 和 SwiftMailer 从 ec2 发送电子邮件。

设置邮件配置如下

   'mailer' => [
        'class' => 'yii\swiftmailer\Mailer',
        'useFileTransport'=>false,
        'transport' => [
            'class' => 'Swift_SmtpTransport',
            'host' => '',// amazon smtp host 
            'username' => '',// ses user username
            'password' => '',// ses user password
            'port' => '587',
            'encryption' => 'tls',
            ],
    ],

您需要创建 ses-smtp IAM 用户或将以下 "AmazonSesSendingAccess" 策略附加到现有用户