【问题标题】:Unable to send emails from Amazon EC2 hosted website无法从 Amazon EC2 托管网站发送电子邮件
【发布时间】:2015-03-02 12:59:49
【问题描述】:

我安装了 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; 

请推荐

【问题讨论】:

    标签: php email amazon-web-services amazon-ec2 amazon-ses


    【解决方案1】:

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

    这最终导致的是“使用 SES”。

    Here's an unofficial how to bolt SES on,但更好的选择是use the AWS PHP SDK to send email to SES

    【讨论】:

      猜你喜欢
      • 2016-09-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-03-19
      • 2012-06-24
      • 2017-05-09
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多