Considering the wide variety of email services currently available and the task of keeping all the moving parts of a start up running. For sending emails why not use one of the services already available ? What did you say … you want to save money ? ..you want do be super “lean” ? Well I wasted a lot of time trying to get my emails from being routed to the spam folder amongst other things.
- Metrics around your email
- One less infrastructure based service to maintain
- Fewer rejects and as a result higher conversions
The last thing you would want is for your users to not be albe to sign up for web application at launch because they are not aware that the confirmation is in the spam folder or worst didn’t even reach their inbox.
Using one of the email services available such as Amazon SES, SendGrid and others would more than likely be saving you time and effort and as a result money.
I have decided to use Amazon SES mainly because its much cheaper than all the other services. Configuring Amazon SES is relatively straight forward. In this post I will be configuring a rails application to use Amazon SES.
1. Register the email that you will be using with Amazon SES in your web application and verify it inside your Amazon Console.
2. Configure your application to use SES by installing the aws-ses gem. You will need to create this file
1 |
config/initializers/amazon_ses.rb |
it is not created by default. Also do not confuse the {username and password} for{ access key and the secret key }.
See the gem documentation for details.
3. Ensure to enable this option in environments/$ENV.rb file .
This will allow you to immediately know if the email was sent or not, it raises an error, helpful in troubleshooting.
1 |
config.action_mailer.raise_delivery_errors = true |
Once all the above is done test sending registration and confirmations emails. If no error was raised above, you should be in the clear. Wait a few and refresh your Amazon console to see the results and check your inbox. The only thing left to do now is request production acces.