Question

Im doing a ruby on rails project for work and they would like to use sendgrid, but they also like gmail. With gmail it allows you to send an email from the web browser under a different alias but now also supports sending that through another smtp server instead of their own.

I was wondering if then, it would be possible to send an email from the RoR project through to gmail (so management gets to keep their nice interface and sent box), but then it would forward it through to the sendgrid SMTP servers. Just to clarify I know how to and currently can send an email through gmail as a different alias, but this is specifically to forward it through to sendgrid after it gets to gmail.

I currently have a standard setup of:

Myapp::Application.configure do
  config.action_mailer.default_url_options = { :host => 'www.mygenericwebsite.com' }  

  config.action_mailer.delivery_method = :smtp 
  config.action_mailer.smtp_settings = {
          :enable_starttls_auto => true, 
          :address => 'smtp.gmail.com',  
          :port => 587,
          :tls => true,
          :authentication => :plain,
          :domain => 'mygenericwebsite.com',
          :user_name => "user@mygenericwebsite.com",
          :password => "pA55w0RD"
          }

class UserMailer < ActionMailer::Base
  default :from => "HappyAdmin <user@mygenericwebsite.com>"
Was it helpful?

Solution

You could send via Sendgrid and BCC the Gmail address in your emails, and then apply a label to emails from the app based on the From address. Not sure if you can apply the Sent label, but another label would probably be all right. I think this would be simpler and more robust than sending each email twice.

OTHER TIPS

Just wanted to point out that our product, PostageApp, will allow you to send via the Google SMTP if you are so inclined. All you have to do is add the SMTP details to your project and you're good to go.

I just checked with the personal project I have hooked up with Postage and all the emails sent out appear in the Sent Mail folder.

Let me know if that's what you're looking for, or if you have any other questions!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top