I write this post just to see if I can get some clarifications regarding email sending concepts in an AWS EC2 instance.
This is related with this other post Rails does not send emails on AWS
I´m developing a Rails application that sends emails to customers (such as confirmation or information emails).
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).
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
.
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?
Amazon Simple Email Service (SES) is a cost-effective email service built on the reliable and scalable infrastructure that Amazon.com developed to serve its own customer base. With Amazon SES, you can send transactional email, marketing messages, or any other type of high-quality content to your customers.
While running in sandbox mode you can only send to verified users - once your account has been activated, you can send to anyone.
According to the EC2 FAQ there's a limitation. aws.amazon.com/ec2/faqs Q: Are there any limitations in sending email from Amazon EC2 instances? Yes. In order to maintain the quality of Amazon EC2 addresses for sending email, we enforce default limits on the amount of email that can be sent from EC2 accounts.
Amazon Simple Email Service (SES) is a cost-effective, flexible, and scalable email service that enables developers to send mail from within any application. You can configure Amazon SES quickly to support several email use cases, including transactional, marketing, or mass email communications.
Sending emails from EC2 instances is limited by Amazon and strictly throttled at network level. This is to prevent spamming and other abuses.
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.
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)
Seb
As sebasto wrote, sending emails is limited.
https://aws.amazon.com/ec2/faqs/ => Q: Are there any limitations in sending email from EC2 instances?
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
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With