0

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?

justingordon
  • 12,553
  • 12
  • 72
  • 116

2 Answers2

1

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 :)

James Adam
  • 2,324
  • 3
  • 16
  • 19
0

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:

Vincent B.
  • 4,038
  • 1
  • 23
  • 18
  • I'm having this problem specifically with gmail marking my devise email messages as spam. It's causing me enough of a headache that I'm even considering disabling email confirmation. – James Adam Jan 18 '13 at 20:41
  • Use a third party to take care of this then. Largely better than rolling your own solution in most cases. – Vincent B. Jan 19 '13 at 07:13