无法从 Amazon EC2 托管网站发送电子邮件

Unable to send emails from Amazon EC2 hosted website

我安装了 postfix 以启用 SMTP

我遵循了所有步骤..直到星期四,我才能够在我经过验证的电子邮件地址上收到我的电子邮件

但他们是空白的。

周六突然停了

php 代码的执行方式与之前执行的方式相同

    <?php
    header('Content-type: application/json');
    $status = array(
        'type'=>'success',
        'message'=>'Email sent!'
    );

    $name = @trim(stripslashes($_POST['name'])); 
    $email = @trim(stripslashes($_POST['email'])); 
    $subject = @trim(stripslashes($_POST['subject'])); 
    $message = @trim(stripslashes($_POST['message'])); 

    $email_from = $email;
    $email_to = 'abc@gmail.com';


    $body = 'Name: ' . $name . "\n\n" . 'Email: ' . $email . "\n\n" . 'Subject: ' . $subject . "\n\n" . 'Message: ' . $message;

    $headers = "From: mail <$email_from>\r\n";
$headers .= "MIME-Version: 1.0" ."\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
    $success = mail($email_to, $subject, $body,$header);
    echo json_encode($status);
    die; 

请推荐

AWS throttles emails sent through EC2 servers。节流率未公布。某些 EC2 IP 地址也可能存在黑名单问题。

最终导致的是"use SES"。

Here's an unofficial how to bolt SES on, but the better option is to use the AWS PHP SDK to send email to SES.