# ActionMailer and Gmail

**URL:** <https://www.ruby-forum.com/t/actionmailer-and-gmail/48491>\
**Category:** Rails\
**Created:** [November 21, 2005, 1:30pm UTC](https://www.ruby-forum.com/t/actionmailer-and-gmail/48491 "2005-11-21T13:30:21Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![adam.groves](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/cab0a1/32.png) [@adam.groves](https://www.ruby-forum.com/u/adam.groves)\
**Post date:** [November 21, 2005, 1:30pm UTC](https://www.ruby-forum.com/t/actionmailer-and-gmail/48491/1 "2005-11-21T13:30:21Z")

</div>

Has anyone successfully sent a mail from AM through google’s smtp?  
in environment.rb I have:

# Include your app’s configuration here:

ActionMailer::Base.server\_settings = {  
:address =\> “[smtp.gmail.com](http://smtp.gmail.com) [http://smtp.gmail.com](http://smtp.gmail.com)”,  
:port =\> 587,  
:domain =\> ‘[www.mydomain.com](http://www.mydomain.com) [http://www.mydomain.com](http://www.mydomain.com)’,  
:user\_name =\> “removed\_email\_address@domain.invalid”,  
:password =\> “password”,  
:authentication =\> :login  
}  
I ask because I don’t have access to a mail server, have a gmail  
account  
though and want to try out action mailer.

---

<div class="post-metadata">

**Author:** ![adam.groves](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/cab0a1/32.png) [@adam.groves](https://www.ruby-forum.com/u/adam.groves)\
**Post date:** [November 21, 2005, 1:38pm UTC](https://www.ruby-forum.com/t/actionmailer-and-gmail/48491/2 "2005-11-21T13:38:24Z")

</div>

Why is your :user\_name formatted with HTML?

- james

---

<div class="post-metadata">

**Author:** ![adam.groves](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/cab0a1/32.png) [@adam.groves](https://www.ruby-forum.com/u/adam.groves)\
**Post date:** [November 23, 2005, 8:39am UTC](https://www.ruby-forum.com/t/actionmailer-and-gmail/48491/3 "2005-11-23T08:39:53Z")

</div>

Hi,

Try this. Install a mail server on your machine.

on my winxp based machine i installed the following mail server:

> **[CMailServer - Email Server Download, Mail Server Download for Windows XP,...](https://www.youngzsoft.net/cmailserver/email-server-download.htm)**
>
> CMailServer is an email mail server software for Windows, which provide web based email service. You can use it to setup your own Internet mail server and provide e-mail service for your company and friends. CMailServer is also an anti-virus mail...

create an account : removed\_email\_address@domain.invalid with secret password

then use following settings

:smpt

&&&& [see ur cmail server tools → configuration]

address - localhost  
port - 25  
domain - [yourdomain.com](http://yourdomain.com)  
authenticate - login  
user\_name - test  
password - secret

This works. Hope this helps.

---

<div class="post-metadata">

**Author:** ![adam.groves](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/cab0a1/32.png) [@adam.groves](https://www.ruby-forum.com/u/adam.groves)\
**Post date:** [November 23, 2005, 5:54pm UTC](https://www.ruby-forum.com/t/actionmailer-and-gmail/48491/4 "2005-11-23T17:54:58Z")

</div>

andremedeiros wrote:

> AFAIK, you can’t use GMail’s SMTP with AM, because it communicates  
> through the SSL layer (see GMail’s help on how to setup thunderbird, for  
> instance).

yeah, AndrÃ© Medeiros is right… gmail’s smtp server only accepts TLS  
connections…

let’s extend AM to make this happen?

any rails guru around to help on this? 🙂 hehe

---

<div class="post-metadata">

**Author:** ![adam.groves](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/cab0a1/32.png) [@adam.groves](https://www.ruby-forum.com/u/adam.groves)\
**Post date:** [November 24, 2005, 1:28pm UTC](https://www.ruby-forum.com/t/actionmailer-and-gmail/48491/5 "2005-11-24T13:28:18Z")

</div>

Why not setup a local MTA to talk to GMail for you?

My little brother wrote a howto if you’re on \*NIX:

```
http://typo.submonkey.net/articles/2005/09/09/use-gmail-as-a-smart-host

```

On 23/11/05, André Camargo [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> any rails guru around to help on this? 🙂 hehe
> 
> –  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
> 
> * * *
> 
> Rails mailing list  
> removed\_email\_address@domain.invalid  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

–  
Rasputin :: Jack of All Trades - Master of Nuns  
[http://number9.hellooperator.net/](http://number9.hellooperator.net/)

---

<div class="post-metadata">

**Author:** ![adam.groves](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/cab0a1/32.png) [@adam.groves](https://www.ruby-forum.com/u/adam.groves)\
**Post date:** [January 29, 2007, 7:07am UTC](https://www.ruby-forum.com/t/actionmailer-and-gmail/48491/6 "2007-01-29T07:07:22Z")

</div>

Deepak S. wrote:

> then use following settings
> 
> :smpt
> 
> &&&& [see ur cmail server tools → configuration]
> 
> address - localhost  
> port - 25  
> domain - [yourdomain.com](http://yourdomain.com)  
> authenticate - login  
> user\_name - test  
> password - secret
> 
> This works. Hope this helps.

I did this and added the following to my environment.rb file, _inside_  
the Rails::Initializer.run do |config| block:

#Mail Server Settings  
config.action\_mailer.server\_settings = {:address =\> ‘localhost’,  
:port =\> 25,  
:domain =\> ‘[mydomain.com](http://mydomain.com)’,  
:user\_name =\> ‘user’,  
:password =\> ‘password’,  
:authentication =\> ‘plain’}

Would you expect this to work?

Does this section need to be set up with  
ActionMailer::Base.server\_settings = {…}?

My development log seems to think that the mail is being sent but it  
isn’t going through.

Thanks,  
Wes

---

<div class="post-metadata">

**Author:** ![adam.groves](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/cab0a1/32.png) [@adam.groves](https://www.ruby-forum.com/u/adam.groves)\
**Post date:** [November 23, 2005, 4:44pm UTC](https://www.ruby-forum.com/t/actionmailer-and-gmail/48491/7 "2005-11-23T16:44:28Z")

</div>

AFAIK, you can’t use GMail’s SMTP with AM, because it communicates  
through the SSL layer (see GMail’s help on how to setup thunderbird, for  
instance).

---

<div class="post-metadata">

**Author:** ![adam.groves](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/cab0a1/32.png) [@adam.groves](https://www.ruby-forum.com/u/adam.groves)\
**Post date:** [January 29, 2007, 10:35am UTC](https://www.ruby-forum.com/t/actionmailer-and-gmail/48491/8 "2007-01-29T10:35:14Z")

</div>

Interesting, please let me know if this works for you. For me I  
haven’t had such luck, I’m using Google Domain Apps for my domain. At  
the moment I just have Rails talk to the local postfix install which  
then simply smartrelay’s over SSL to [smtp.gmail.com](http://smtp.gmail.com). There seems to  
be issues configuring it from within the rails app due to gmail’s  
security requirements for logins? Though I’d love to get this working  
straight from my rails app.

On Jan 29, 7:07 am, Wes G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![adam.groves](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/cab0a1/32.png) [@adam.groves](https://www.ruby-forum.com/u/adam.groves)\
**Post date:** [January 29, 2007, 10:38am UTC](https://www.ruby-forum.com/t/actionmailer-and-gmail/48491/9 "2007-01-29T10:38:16Z")

</div>

Hey mate,

If your development is on a mac, go to your terminal and run mail. If  
mail isnt getting sent out it will tell you why in there.

Cheers,  
Carl.

On 1/29/07, removed\_email\_address@domain.invalid [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> wrote:
> 
> > > authenticate - login  
> > > :user\_name =\> ‘user’,
> > 
> > Thanks,  
> > Wes
> > 
> > –  
> > Posted viahttp://www.ruby-forum.com/.
> 
> >

–  
Carl W.  
0412218979  
removed\_email\_address@domain.invalid
