I want to setup amp-email in ruby-on-rails. So I can get benefit of dynamic email content.
I have found rails_amp gem and using this I have made changes in mime_types.rb file
Mime::Type.register_alias 'text/html', RailsAmp.default_format
and also made changes in rails_amp.yml file. which is shown below.
targets:
mailers:
and setup a mail with view of amp.erb. But it isn't sending dynamic email and make it html forcefully and mail doesn't have dynamic email symbol.
Can any one please guide me how to setup mailer to send dynamic emails?
It seems rails_amp was last updated almost 2 years ago, before AMP for Email existed, so I believe it doesn't support this format.
For Gmail, you also need to whitelist your sender email following the steps outlined in Test dynamic email.
A little late, but posting here for anyone who comes to this link in future.
I couldn't find a way to test AMP Emails in development environment, so I had to deploy my application live and has domain setup. Then I added TXT records to DNS so that emails can pass Domain Keys Identified Mail (DKIM) and Sender Policy Framework (SPF) authentication.
To test AMP Emails in Gmail, I enabled developer settings and added email from my domain to whitelist it.
Then I configured ActionMailer to send amp, html and text format emails. I have created a blog post here to explain, how AMP Emails can be implemented in A Ruby on Rails Application.
Related
I am in need of help figuring out a how to set up incbound email with Griddler and Gmail for Work. I've got a Rails 4 that I'm trying to configure to receive incoming emails using Griddler and SendGrid. I followed the instructions on the Griddler readme exactly. Next I created a tunnel to my localhost environment using ngrok.io. I then went into the SendGrid web app and created a webhook to catch emails going to example.com and send them to the url abc123.ngrok.io.
So far, I think I've got the setup correct. Next I set up an MX record in my domains DNS zone file. The host is # and it points to mx.sendgrid.net.
Here is where things get tricky for me. My site has Gmail for Work set up. I'm not super particular on the details, but essentially, I want a way for users to send a message to foo#bar.example.com and have it routed to Griddler, rather than Gmail. The format of the email address is not terribly important except that it must be dynamic in the sense that foo can be replaced with anything and it will still be routed to Griddler, as long as the domain is bar.example.com. If the domain is just example.com, then it should be routed to Gmail.
I've not had much luck finding resources on how to set this up.
Thanks!
You need to configure 2 separate MX records, one for example.com, and one for bar.example.com. Have the subdomain record point to SendGrid, and have the domain use gmail's MX.
I am studying a project vish, which has an open source e-Learning platform http://vishub.org, in here, if some one comments another one's Excusion, one email will be sent. This ability is finished by using mailboxer.
But when I run a instance of vish locally, for validate mailboxer, I used a task sending some messages between all users, it worked fine, and I can find the new messages in the header's notification dropdown menu, but I did not get a email when I commented some one Excursion like in vishub, and did not get any error message about mailboxer. According to my newbie experience, I guess that I should config a mail server, but I don't know how to config a mail server for mailboxer, it seems that there is no one discuss about it?
What should I do for enabling mailboxer email? Or any manual should I read? Or my question is not relative to mailboxer? Thanks in advance!
Updated:
According to #rick's reminding, I read some code of mailboxer:
class NotificationMailer < ActionMailer::Base
end
It make me clearer about the relationship between ActionMailer and MailBoxer!
Email wont't be sent in development unless you set config.action_mailer.perform_deliveries = true in environments/development.rb. and also you should use ActionMailer to send email locally. For more information, you can refer this link mailboxer
I want an E-Mail to be sent using a background process whenever an Invite was generated.
What I currently have is this approach: The Invite model has the method send_mail, which sends an E-Mail using the Mandrill API and gem. It also has the method queue_mail adds InviteMailer with the invite's ID to the queue using Resque.
However… Since I'm having sort of a really hard time writing specs for this, I assume this might not be the best approach to send mails.
What I mainly want and need to test:
was the mail added to the queue?
is InviteMailer working properly?
does the mail contain the correct vital information?
Vital informations are: sent to the correct person, contains a link to a specific site and some specific data/text; also I'm not sure how to get the current host to the link.
I don't think this is a rare thing to do, so I wonder what the best practices are.
My testing environment: rspec, capybara, factory girl. I already added VCR, to cache the API-request.
You can use Mailcatcher to fake your mail server, and check received mail via web API:
Features
Catches all mail and stores it for display.
Shows HTML, Plain Text and Source version of messages, as applicable.
Rewrites HTML enabling display of embedded, inline images/etc and open links in a new window. (currently very basic)
Can send HTML for analysis by Fractal.
Lists attachments and allows separate downloading of parts.
Download original email to view in your native mail client(s).
Command line options to override the default SMTP/HTTP IP and port settings.
Mail appears instantly if your browser supports WebSockets, otherwise updates every thirty seconds.
Growl notifications when you receive a new message.
Runs as a daemon run in the background.
Sendmail-analogue command, catchmail, makes using mailcatcher from PHP a lot easier.
Written super-simply in EventMachine, easy to dig in and change.
How
gem install mailcatcher
mailcatcher
Go to http://localhost:1080/
Send mail through smtp://localhost:1025
API
A fairly RESTful URL schema means you can download a list of messages
in JSON from /messages, each message's metadata with
/messages/:id.json, and then the pertinent parts with
/messages/:id.html and /messages/:id.plain for the default HTML
and plain text version, /messages/:id/:cid for individual
attachments by CID, or the whole message with /messages/:id.source.
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
I m new at ROR, so it may be a silly ques.
I'm using ActionMailer to send a mail to any reciepient.
Initially i have tried it using gmail smtp setting.
But in that everytime the mail is sent, it is from the same mail_id.
But in my application I want sender to be different at different time.
So, is it possible to do it using ActionMailer??
Not sure what version of Rails you are on (it shouldn't matter for this one), but this question has already been answered here: Rails and Gmail SMTP, how to use a custom from address