Is there a way to save ActionMailer mails to files as a way of logging the sent mails upon delivery?
I have a lot of e-mails that go missing and would like to log the sent mails in files (i.e., I want my web site admin to look through the e-mails, so storing them in files besides having them in my general log file would be helpful in implementing a user-friendly solution).
If I can access the contents and addressees of a sent mail, then I can save them to files, but I cannot find a clear way to access the contents of an e-mail from within ActionMailer.
There was a similar question but the only answer there doesn't help me to solve this problem, some pointers or actual code to implement this would be really helpful.
Thank you.
Related
I am using Mailcore (https://github.com/MailCore/mailcore2) for accessing IMAP mail.
I could able to get all the inbox mails using this sample given. I able to retrieve all the mail folders as well. I want to implement compose functionality using this. I am not getting API details or samples for this. Could someone please help me ?
IMAP is an email retrieval protocol, it is not used for sending. For that, you have SMTP. So you were probably just looking in the wrong place...
I've never used mailcore2, but after reviewing their wiki pages, I found their example for composing and sending messages using STMP here.
We send out many emails through Rails (and then through Amazon SES). I'd like to now log all of those emails in our database so we know exactly which emails were sent where and all the details. I'd also love to know which class/method sent those emails or some way to tag them.
This must be an extremely common need, so I'm curious if there's a mechanism with Rails to automatically handle this?
mail-logger gem captures the info about the emails sent, and log them to a file.
With a little bit of work it could be customized to write to a database instead.
The gem is overriding delivered_email method to log the details:
class Mail::Logger::Callback
def self.delivered_email(email)
Mail::Logger.logger.info email.inspect
end
end
With my rails application, I'm supposed to provide following features:
There a limited number of users interacting with my system (in order of 10 to 20)
Like any normal mail client users should be able to have an inbox page showing received message, response to individual email and etc....
The mail client part cannot be an external application, they want everything packaged into a single application!
Normally These emails should be stored for future use
In order to send a receive email, we do not need to setup a mail server. They will provide the server and we will fetch the message with POP3 or something else. Same goes for sending emails.
The application itself often needs to look into these message as well, so it should be able to access corresponding email objects.
Separate part of these applications can be handled with individual gems such as Mailman, ActionMailer, and etc...
But what would be your suggestions to get this done?
I suggestion customizing an open source solution according to your needs. This is a gem/project that you should look at https://github.com/mailboxer/mailboxer It has all the features that you mentioned and its straightforward in its customizations.
One issue I'm seeing with Devise is that confirmation emails can go to the spam folder. If the user could simply respond to the email, that would serve to confirm the email address and it would train gmail that the sender is not spam.
Any recommendation on if this is worth doing and how would I do it?
Or maybe there's a much easier way to avoid having sent application mails go to spam?
I've been having the exact same issue, and after a long night I believe I have it sorted out.
1) Make sure you have an SPF record set up for your domain.
2) Set up DKIM on your mail server and put your public key in your DNS (TXT record).
3) Make sure your html email is properly formatted ( I had to add the html opening and closing tags to mine, Devise did not do this by default).
4) The last piece of the puzzle was making sure I was sending both plaintext and html MIME parts in my emails. Just creating an additional plaintext 'text.erb' file for each of my mail views seemed to do the trick (Rails auto-magically picked it up and constructed multipart emails for me).
You can verify 1 and 2 are setup right by viewing the 'original' email within Gmail and making sure you see something like "spf=pass" and "dkim=pass" in the headers.
A friend informed me about a service called SendGrid (and I'm sure there are other service providers that do exactly the same thing) after I had spent nearly an entire night going from WTH is DKIM? -- to getting way more familiar with SMTP, DNS, and postfix than I ever wanted to be. But it works now, and I'm probably too cheap to pay for a third party service anyway :)
This is not Devise's fault. Devise actually follows the best practices concerning confirmation of email address.
I believe you fall in the category of bulk email senders, and that you will have to follow quite a few guidelines to sort this out.
I would advise you to go through Google help pages for more information on how to fix this:
Configuration help: https://support.google.com/mail/bin/answer.py?hl=en&answer=81126
Help wizard: https://support.google.com/mail/bin/static.py?hl=en&ts=2696779&page=ts.cs
Requirement:
I am writing a web application (Rails on Heroku) through which users can create groups and user should be able to post a message to the group simply by sending an email to the group.
This is what tumblr.com does: each blog is associated with an email address(randomly generated) and user can post to the blog simply by sending an email. Also posterous.com has this feature.
Question:
What is the best way to architect a solution like this one? Comments? Ideas?
I see 2 ways of doing this:
1) Hosting my own email server (sendmail or postfix) on Amazon EC2 and having some script to process all the incoming email?
This will give me a lot of control but an email server to maintain.
2) Have the email server hosted somewhere and just have to write the email processing script would be nice however I do not know of any email cloud service to which you can tell: "please accept all the email for mydomain.com".
Thanks in advance for any help.
I think I am going to go with http://cloudmailin.com. They even have a nice Heroku plug-in. It would be nice to hear any good or bad experience from somebody that tried this out.
You could have the emails sent to GMail through their SMTP servers and run some sort of crontab to pull down the emails from GMail, and process them from there.
They do allow you to have emails sent to your domain.com, see this page:
http://www.google.com/apps/intl/en/group/index.html