php 使用 Amazon EC2 实例发送邮件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19858457/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 20:08:58  来源:igfitidea点击:

Send Mail Using Amazon EC2 Instance

phpamazon-web-servicesamazon-ec2sendmail

提问by sourabh kasliwal

I am using Amazon EC2 Instance for one of my project, I have installed LAMP on linux server and now while I am trying to send email using simple function it is not sending email also is not giving any error for that.

我正在为我的一个项目使用 Amazon EC2 实例,我已经在 linux 服务器上安装了 LAMP,现在当我尝试使用简单功能发送电子邮件时,它不发送电子邮件也没有给出任何错误。

Things I have done so far.

到目前为止我所做的事情。

  • Created SES account.
  • Used simple mail function.
  • Enabled port 25 in security groups.
  • 创建了 SES 帐户。
  • 使用简单的邮件功能。
  • 在安全组中启用端口 25。

回答by PabloQ

I solved this issue just by installing sendmail in my instance. Just run bellow command in your terminal

我只是通过在我的实例中安装 sendmail 解决了这个问题。只需在终端中运行波纹管命令

sudo apt-get install sendmail

sudo apt-get install sendmail

That worked for me

那对我有用

回答by SamV

Although your problem relates to Sendmail have you tried following Amazons Documentation?

尽管您的问题与 Sendmail 相关,但您是否尝试过遵循 Amazons 文档?

http://docs.aws.amazon.com/ses/latest/DeveloperGuide/send-email-smtp-app.html

http://docs.aws.amazon.com/ses/latest/DeveloperGuide/send-email-smtp-app.html

This uses postfix but it seems like a better alternative and there's help readily available for it.

这使用了 postfix,但它似乎是一个更好的选择,并且可以随时获得帮助。

You also can use SMTP as Amazon SES supports this:

您也可以使用 SMTP,因为 Amazon SES 支持此功能:

http://docs.aws.amazon.com/ses/latest/DeveloperGuide/send-email-smtp.html

http://docs.aws.amazon.com/ses/latest/DeveloperGuide/send-email-smtp.html

I know this doesn't directly answer your question. You might just need to configure the mailsettings in php.ini.

我知道这并不能直接回答您的问题。您可能只需要mailphp.ini.

回答by William Worley

If you are using a amazon ec2 ami/linux distro use "sudo yum install sendmail" while in SSH

如果您使用的是亚马逊 ec2 ami/linux 发行版,请在 SSH 中使用“sudo yum install sendmail”

回答by E.J. Brennan

If you are using AWS SES you need to make sure you validate the account first:

如果您使用 AWS SES,您需要确保首先验证账户:

http://docs.aws.amazon.com/ses/latest/DeveloperGuide/verify-email-addresses.html

http://docs.aws.amazon.com/ses/latest/DeveloperGuide/verify-email-addresses.html

With the exception of addresses containing labels (see below), you must verify each email address that will be used as a "From" or "Return-Path" address for your messages. The entire email address is case-sensitive. For example, if you verify [email protected], you cannot send emails from [email protected] unless you verify [email protected] also. (Domain verification, however, is case-insensitive. For more information, see Verifying Domains in Amazon SES.)

Until you are granted production access to Amazon SES, you must also verify the email address of every recipient except for the recipients provided by the Amazon SES mailbox simulator. For more information about the mailbox simulator, see Testing Amazon SES Email Sending. For more information about production access, see Requesting Production Access to Amazon SES.

除了包含标签的地址(见下文),您必须验证将用作邮件“发件人”或“返回路径”地址的每个电子邮件地址。整个电子邮件地址区分大小写。例如,如果您验证 [email protected],则不能从 [email protected] 发送电子邮件,除非您也验证 [email protected]。(但是,域验证不区分大小写。有关更多信息,请参阅在 Amazon SES 中验证域。)

在您被授予对 Amazon SES 的生产访问权限之前,您还必须验证每个收件人的电子邮件地址,但 Amazon SES 邮箱模拟器提供的收件人除外。有关邮箱模拟器的更多信息,请参阅测试 Amazon SES 电子邮件发送。有关生产访问的更多信息,请参阅请求对 Amazon SES 的生产访问。