Exim sync emails from AWS SES - imap

I would like to build a new email server.
I am familiar with Exim+Dovecot solution. But it's a bit complicated to set up.
So I would like to try AWS SES because it's much simpler to start and has nice integration with mainstream mail servers.
The problem I am having is how do I recieve emails. It seems SES will put all the received mails in a S3 bucket. But I want to receive mails on my phone, ipad, laptop, so I still need an imap server. Is it possible to have a script to sync the s3 bucket to my exim server so that exim can forward the email to dovecot?

Related

Rails 6 Action Mailbox and Gmail Integration How To

Rails 6 comes with Action Mailbox now. The documentation and community do not have great resources on how to integrate various services outside of the most common such as SendGrid.
Assuming a person uses Google's Gsuite Gmail:
How could they integrate that with Action Mailbox?
Would one use Gmail's API, or would that not be appropriate for Action Mailbox?
If Gmail doesn't work, what is different about SendGrid that makes it integrate appropriately?
Action Mailbox is built around receiving email from a Mail Transfer Agent (MTA) in real time, not periodically fetching email from a mailbox. That is, it receives mail sent via SMTP, it doesn't fetch mail (using IMAP or POP3) from another server that has already received it.
For this to work it is dependent on an external (to Rails) SMTP service receiving the email and then delivering the email to Action Mailbox. These external services are called "Ingresses" and, as at the time of writing, there are 5 available ingresses.
Of the five, four are commercial services that will run the required SMTP servers for you and then "deliver" the email to your application (usually as a JSON payload via a webhook).
Mailgun - scroll down to "Inbound"
Mandrill
Postmark
Sendgrid
You could already use those services in a Rails App and handle the webhooks yourself but Action Mailbox builds a standardised set of functionality on top. Almost like a set of rails to guide and speed the process.
In addition, the fifth ingress is the "Relay" ingress. This allows you to run your own supported MTA (SMTP server) on the same machine and for it to relay the received email to Action Mailbox (usually the raw email). The currently supported MTAs are:
Exim
Postfix
Qmail
To answer your specific questions about Gmail:
How could they integrate that with Action Mailbox?
They couldn't directly. They would need to also set up one of the 7 MTAs listed above and then somehow deliver the emails to that. The delivery could be accomplished with:
Forwarding rules managed by the user at the mailbox level
Dual delivery, split delivery or some other advanced routing rule managed by the admin at the domain level
Would one use Gmail's API, or would that not be appropriate for Action Mailbox?
Even if there were a way to have Gmail fire a webhook on incoming email (I'm not aware of any special delivery options outside the advanced routing rules above), there is currently no way to connect that theoretical webhook to Action Mailbox.
If Gmail doesn't work, what is different about SendGrid that makes it integrate appropriately?
Sendgrid (to use your example, the others work more or less the same way) offers an inbound mail handling API. Just as importantly, the Rails Team has built an incoming email controller to integrate with that API.
Given the lack of Gmail APIs and the lack of a Rails ingress controller, the only way I can think of that you could connect Action Mailbox to an existing Gmail mailbox would be for some other bit of code to check the mailbox, reformat the fetched email and then pose as one of the supported MTAs to deliver it to Action Mailbox.
It would be an interesting exercise and would possibly become a popular gem but it would very much be a kludge. A glorious kludge if done well, but a kludge nonetheless.
Another option would be to leave your example.com domain delivering to Gmail as normal and set up another domain for your Action Mailbox emails. You could use a separate domain, example.org, or a subdomain, app.example.com.
This would involve setting up one of the 7 supported SMTP servers and pointing the MX records for example.org or app.example.com at those servers.
Bonus trivia: Another name for an MTA is a Mail eXchager, hence the name for a DNS mail record is an MX record.
To integrate IMAP with Rails, have a look into the greate mail_room Gem
It's a daemon that you can start alongside your app, which listens onto couple of IMAP inboxes, and then convert those into either a Sidekiq Worker or push it via http to your app.
It's used by Gitlab for their mail interactions (Answer to thread, create issue by writing to an email).
They also have a section on how to integrate with ActionMailbox.
If you were dead set on doing this, Gmail has had IMAP IDLE (push) support since day one.
It would be quite easy to write a small daemon that watches a Gmail inbox and calls the rails action mailbox webhook endpoint with a properly formatted JSON payload.

mbsync - Delete a mail from gmail server but not from the local machine

I want to delete mails from gmail server to save my google drive space but I want to preserve them on my local Maildir for a backup. How do I accomplish that. I use mbsync to keep my mails synced and mu4e in emacs as the client.

Using sendgrid with rails so I can send emails from Google Cloud Platform on port 465. Isnt working

Its my first time playing around with sending emails in an application. I'm using an instance on the google cloud platform and found out that they block sending emails form port 465. They have an work around solution which is using a third part to send the emails. I decided to go with sendgrid. But there are a few different options for setting it up and I'm not sure which is the one I'm supposed to use for CGP to allow me to send emails using SSL.
I followed this tutorial by sendgrid but I still have the instance blocking port 465. Am I supposed to do it a different way? If so what am I supposed to do?
To send email via SendGrid from gcp, you need to use port 2525.
See this link for more information on using SendGrid.

Features of Mandrill API

I am new to Mandrill and its integration. Can anyone help me to figure out the advantages of using Mandrill? What can be done using Mandrill other than sending messages and tracking them?
Mandrill has many uses. You might have seen those on their website itself. Actually its a Mail Transaporter like PHP mailer, but it uses their own server for sending mails.
As said on their website,
Mandrill runs on a globally distributed infrastructure that can
deliver emails in milliseconds.
This is because when you send a mail through their SMTP or send.json (API) method, the send mail possibly see the fastest path algorithm to deliver a mail. That's why it take milliseconds to deliver. They have ~7 different mail servers worldwide for this.
Major Features,
Sending mails fastly than our own server using PHP Mailer.
Sending mails via pre-designed templates which can be reusable by the merge vars we're using.
Support multiple language platforms like, cURL, JSON, Python, PHP, Ruby, Nodejs, Dart and also their depending frameworks.
It tracks clicks from the mail we sent. For Ex: each and every url link in our sent mails is redirected only after tracking from mandrillapp site. This enables mandrill to track the no of opens in a mail and track analytics.
Through mandrill we can construct our own mail sending application or integrate into an existing application.
It's mostly used for Transactional Messages like functions like welcome mail, forgot password, cart details and etc.
It can be integrated into other shopping cart web applications.
Their api call works on even in the developer environment.
Lesser spam.
Verified domain options like DKIM and SPF settings. This enables the mails to identified by major email providers like gmail, google, etc.
It can be used as SMTP version and can be integrated into major SMTP applications.
Reports: Demographics of email send, Compare status, Which url in our mails has been clicked and no of counts.
Setup rule for delivering emails.
A/B testing, custom SMTP headers, Inbound domains and etc.
There are many other features in developer perspective. If you mention in which platform you're trying to use mandrill addditional details can be provide.
Hope this might help you.
To name a few, You can
1) use templates to do A/B testing ( which allow you to experiment with different templates, and end up with something which is effective).
2) use Embedded images , which will reduce the chance that your emails will end up in spam.
Hope this helps,

postfix configuration with SES and attachments

Background: I've a rails app that sends out transactional and notification emails. 1/20 emails needs to have an attachment.
I'm using postfix, and just setup Amazon Simple Email Service to handle outgoing email.
My understanding is that Amazon SES doesn't currently support sending emails with attachments.
In postfix SES is currently setup as default_transport. Ideally, I'd like to configure it to send out using SES for emails without attachments, and send email without SES for emails with attachments (since SES will reject them anyway).
Is this possible?
If postfix doesn't support this kind of setup, how would I get my rails app to send out emails without attachments using SES and other email without it?
Amazon SES now supports attachments.
This question was asked nearly a month ago, did you find a solution to your problem?
I think it would be difficult to configure Postfix as you say, I'd suggest two alternatives:
configure Postfix to deliver the emails normally, in this case you'll be able to send attachments. (You'd not use SES at all).
leave your Postfix configuration as is, and instead of using attachments you can upload the file somewhere (maybe on S3 since you're using AWS) and post the link in the email. (You'd use only SES).

Resources