简体   繁体   English

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

[英]Unable to send emails from Amazon EC2 hosted website

I installed postfix in order to enable SMTP 我安装了postfix以启用SMTP

i followed all the steps.. i was able to receive my emails on my verified email address till thrusday 我遵循了所有步骤。.直到星期四,我都可以通过经过验证的电子邮件地址接收电子邮件

but they were blank. 但他们是空白。

suddenly it stopped on saturday 突然在星期六停止了

the php code is executing in the same way as it use to execute earlier 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; 

please suggest 请建议

AWS throttles emails sent through EC2 servers . AWS限制通过EC2服务器发送的电子邮件 The throttle rate isn't published. 节流率未发布。 Some EC2 IP addresses may have problems with blacklists too. 某些EC2 IP地址也可能存在黑名单问题。

Ultimately what this leads to is "use SES". 最终导致的结果是“使用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 . 这是非正式的SES固定方法 ,但是更好的选择是使用AWS PHP SDK向SES发送电子邮件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM