Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using ActionMailer with a company Gmail account

I'm not sure if this belongs in server fault or here feel free to move it if it makes more sense somewhere else. I've seen the examples for setting up the smtp settings and using ActionMailer with Gmail and confirmed that they work for me.

Basically it looks like this for me:

config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
  :address              => "smtp.gmail.com",
  :port                 => 587,
  :user_name            => '<username>',
  :password             => '<password>',
  :authentication       => 'plain',
  :enable_starttls_auto => true  }

What I need to do now is to send an email to an address that isn't a plain Gmail account and yet, at it's core, is Gmail. My company uses whatever google's email service that allows you to use gmail but for the addresses to be listed as [email protected] rather than @gmail.com. I know for a fact that you can't simply log into our mail at the main gmail site so I assume our domain is different. Or something.

At the moment, when I simply use my own company user/pass I get an error message telling me that the user/pass was wrong. But I'm guessing the issue is that I'm trying to mail from the gmail variant of my username.

I have confirmed that our smtp server, as far as Thunderbird is concerned, is the normal gmail smtp, that our port is still 587, and that we are using TLS. What do I need to change here so that I can send an email to one of these addresses? Thanks.

like image 579
keybored Avatar asked Mar 31 '11 16:03

keybored


People also ask

What is Actionmailer?

Action Mailer allows you to send emails from your application using mailer classes and views.

How do you send mail in Ruby?

To send the mail you use Net::SMTP to connect to the SMTP server on the local machine and then use the send_message method along with the message, the from address, and the destination address as parameters (even though the from and to addresses are within the e-mail itself, these aren't always used to route mail).


1 Answers

I have my own domain setup at google for mail, the url to log into that directly is

http://mail.google.com/a/my.company.com

My rails app that sends mail through that account, has

:domain => "my.company.com"

as well as all the other fields you have.

"<user_name>" needs to be the whole email address, not just the user name.

like image 108
Nick Avatar answered Nov 10 '22 03:11

Nick