热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

从AWSEC2实例发送电子邮件(SES是强制性的?)-SendemailsfromAWSEC2instance(SESmandatory?)

IwritethispostjusttoseeifIcangetsomeclarificationsregardingemailsendingconceptsina

I write this post just to see if I can get some clarifications regarding email sending concepts in an AWS EC2 instance.

我写这篇文章只是为了看看我是否可以对AWS EC2实例中的电子邮件发送概念做出一些澄清。

This is related with this other post Rails does not send emails on AWS

这与其他帖子有关Rails不会在AWS上发送电子邮件

I´m developing a Rails application that sends emails to customers (such as confirmation or information emails).

我正在开发一个向客户发送电子邮件的Rails应用程序(例如确认或信息电子邮件)。

I dont know exactly which email service is using Rails. I didn´t install any particular gem. But the emails are been sent perfectly in development environment (Ubuntu).

我不确切知道哪个电子邮件服务正在使用Rails。我没有安装任何特定的宝石。但是电子邮件已经在开发环境(Ubuntu)中完美发送。

When I deploy to my production environment (AWS EC2 instance). This functionality is not working. You can see the error details in the post I provided above. The error is related with some smtp connection refused.

当我部署到我的生产环境(AWS EC2实例)时。此功能无效。您可以在我上面提供的帖子中看到错误详细信息。该错误与某些smtp连接被拒绝有关。

So, I have read some other posts but Im confused. Is it mandatory to use the AWS SES service in order to send emails from EC2 instance? Or it is just a problem related to security credentials (maybe I just need to open the smtp 25 port). Do I need to install any email client or server?

所以,我已经阅读了其他一些帖子,但我很困惑。是否必须使用AWS SES服务才能从EC2实例发送电子邮件?或者它只是与安全凭证相关的问题(也许我只需要打开smtp 25端口)。我是否需要安装任何电子邮件客户端或服务器?

2 个解决方案

#1


18  

Sending emails from EC2 instances is limited by Amazon and strictly throttled at network level. This is to prevent spamming and other abuses.

从EC2实例发送电子邮件受亚马逊限制,并严格限制在网络级别。这是为了防止垃圾邮件和其他滥用行为。

If you have a large amount of emails to send to your customers, the recommended way is to use Amazon Simple Email Service. With Amazon SES, you can send transactional email, marketing messages, or any other type of high-quality content and you only pay for what you use.

如果您有大量电子邮件要发送给您的客户,建议的方法是使用Amazon Simple Email Service。使用Amazon SES,您可以发送交易电子邮件,营销信息或任何其他类型的高质量内容,您只需为您使用的内容付费。

If you really need to send emails from an EC2 instance, you must use an Elastic IP Adress and ask Amazon's support to remove limitations on SMTP traffic from that EIP. The form to contact us is available at https://portal.aws.amazon.com/gp/aws/html-forms-controller/contactus/ec2-email-limit-rdns-request (authentication is required)

如果您确实需要从EC2实例发送电子邮件,则必须使用弹性IP地址并要求Amazon支持从该EIP中删除对SMTP流量的限制。有关联系我们的表格,请访问https://portal.aws.amazon.com/gp/aws/html-forms-controller/contactus/ec2-email-limit-rdns-request(需要验证)

Seb

勒布

#2


1  

As sebasto wrote, sending emails is limited.

正如塞巴斯托写道,发送电子邮件是有限的。

https://aws.amazon.com/ec2/faqs/ => Q: Are there any limitations in sending email from EC2 instances?

https://aws.amazon.com/ec2/faqs/ =>问:从EC2实例发送电子邮件有任何限制吗?

Of course it's working, you need to check if you have SMTP installed and it might depends when do you send your's emails

当然它正在运行,你需要检查你是否安装了SMTP,这可能取决于你何时发送你的电子邮件

Try this code:

试试这段代码:

[ec2-user@ip ~]$ irb
irb(main):001:0> require 'net/smtp'
=> true
irb(main):002:0> Net::SMTP.start('localhost') do |smtp|
irb(main):003:1* smtp.send_message 'test from ruby', 'your-email, 'your-email'
irb(main):004:1> end

For mine (@gmail) it's working

我的(@gmail)它正在运作


推荐阅读
author-avatar
阳光明媚-在路上
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有