<?xml version="1.0" encoding="UTF-8"?>
<wiki>
  <body>&lt;html&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;CONTENT-TYPE&quot; content=&quot;text/html; charset=utf-8&quot;&gt;
  &lt;title&gt;&lt;/title&gt;                                                    
&lt;meta name=&quot;GENERATOR&quot; content=&quot;OpenOffice.org 3.1  (Unix)&quot;&gt;
&lt;meta name=&quot;AUTHOR&quot; content=&quot;Phoebe &quot;&gt;
&lt;meta name=&quot;CREATED&quot; content=&quot;20091104;16524100&quot;&gt;
&lt;meta name=&quot;CHANGEDBY&quot; content=&quot;Phoebe &quot;&gt;
&lt;meta name=&quot;CHANGED&quot; content=&quot;20091104;18392000&quot;&gt;
&lt;style type=&quot;text/css&quot;&gt;
&amp;lt;!&amp;#8212;
@page { margin: 0.79in }
P { margin-bottom: 0.08in }
A:link { so-language: zxx }
&amp;#8212;&amp;gt;
&lt;/style&gt;
&lt;/head&gt;
&lt;body dir=&quot;ltr&quot; lang=&quot;en-US&quot;&gt;

&lt;p&gt;I downloaded the bostonrb code and  spent some time to figure out how to make it work. I collected this stuff from many sources.                                              &lt;br /&gt;
I hope this document can save some time for other newbies.&lt;br&gt;&lt;/p&gt;
&lt;p style=&quot;margin-bottom: 0in;&quot;&gt;&lt;font size=&quot;4&quot;&gt;&lt;b&gt;Database Configuration&lt;/b&gt;&lt;/font&gt;&lt;br&gt;&lt;/p&gt;                                                                                  

  &lt;p&gt;Install mysql (or sqllite3) and make sure that a user (or root) to be used in the configuration has been granted permission to create a       database and access it. In mysql, a very broad grant can be in the form of:&lt;/p&gt;                                                                                                                                                         
&lt;pre&gt; GRANT ALL PRIVILEGES ON *.* TO 'phoebe'@'localhost' identified by 'somepasswd'&lt;/pre&gt;
  &lt;p&gt;Create a config/database.yml file to use this database. It follows this general format:&lt;/p&gt;                                                                         

&lt;pre style=&quot;margin-left: 80px;&quot;&gt;
development:
  adapter: mysql
  encoding: utf8
  reconnect: false
  database: bostonrb_development
  pool: 5
  username: phoebe
  password:
  socket: /var/lib/mysql/mysql.sock

test:
  adapter: mysql
  encoding: utf8
  reconnect: false
  database: bostonrb_test
  pool: 5
  username: phoebe
  password:
  socket: /var/lib/mysql/mysql.sock

production:
  adapter: mysql
  encoding: utf8
  reconnect: false
  database: bostonrb_production
  pool: 5
  username: root
  password:
  socket: /var/lib/mysql/mysql.sock
&lt;/pre&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;&lt;font size=&quot;4&quot;&gt;&lt;b&gt;ActionMailer Configuration to send email&lt;/b&gt;&lt;/font&gt;&lt;br&gt;                                                        &lt;br /&gt;
Actionmailer can use either sendmail or smtp. Here, I am writing up directions to use smtp with gmail. I also prefer to use gmail instead of my regular &lt;span class=&quot;caps&quot;&gt;ISP&lt;/span&gt; account because of portability. Gmail requires ssl support, which is build into ruby 1.8.7, but not in ruby 1.8.6. If you don&amp;#8217;t care about using ssl, you can omit it, or check out:&lt;a href=&quot;http://wiki.rubyonrails.org/rails/pages/HowToSendEmailsWithActionMailer&quot;&gt;                  &lt;br /&gt;
http://wiki.rubyonrails.org/rails/pages/HowToSendEmailsWithActionMailer&lt;/a&gt;  where I adapted the following code.&lt;br&gt;                                                                           &lt;br /&gt;
In order to add  ssl into 1.8.6., you need to add smtp_tls.rb to actionmailer. There are a few  implementations. In the the end openrain worked for me. &lt;br&gt;                                                                                                                                                   &lt;br /&gt;
  &lt;li&gt;If you are running 1.8.6 and want to use gmail, install smtp_tls: &lt;/li&gt;                                                                                                       
&lt;pre&gt;gem install openrain-action_mailer_tls -s http://gems.github.com
&lt;/pre&gt;
&lt;li&gt;Create a file called &amp;#8216;config/initializers/actionmailer.rb&amp;#8217; with the following content.&lt;/li&gt; 
&lt;pre&gt;
require &quot;smtp_tls&quot;#Load mail configuration if not in test environment
if RAILS_ENV !='test'
        email_settings = YAML::load(File.open(&quot;#{RAILS_ROOT}/config/email.yml&quot;))
	ActionMailer::Base.perform_deliveries = true
	ActionMailer::Base.default_charset = &quot;utf-8&quot;
	ActionMailer::Base.raise_delivery_errors = true
	ActionMailer::Base.smtp_settings = email_settings[RAILS_ENV] unless email_settings[RAILS_ENV].nil?	
End
&lt;/pre&gt;
                                                                                                                                                                                                                                 &lt;li&gt;Create a file called config/email.yml with the following content&lt;/li&gt;                                                                                                                                                                  

&lt;pre&gt;                                                                     
development:
    :domain:  gmail.com
    :address: smtp.gmail.com
    :port: 587
    :authentication: plain
    :user_name: mylogin@gmail.com
    :password: mypasswd

production:
    :address: smtp.gmail.com
    :port: 587
    :authentication: plain
    :domain:  gmail.com
    :user_name: mylogin@gmail.com
    :password: mypasswd

&lt;/pre&gt;

&lt;p style=&quot;margin-bottom: 0in;&quot;&gt;Alternatively, instead of creating the two files above, in a pinch you can also put the following at the bottom of config/environment.rb to make it work quickly.&lt;/p&gt;                                                                                 

&lt;pre&gt;
 require &quot;smtp_tls&quot;                                                                      
 ActionMailer::Base.delivery_method = :smtp                                           
 ActionMailer::Base.perform_deliveries = true                                          
 ActionMailer::Base.raise_delivery_errors = true                                       
 ActionMailer::Base.default_charset = &quot;utf-8&quot;                                            
 ActionMailer::Base.smtp_settings = {                                                    
        # enable_starttls_auto = 'true', # For 1.8.7 only,skip this one for 1.8.6 
        address = &quot;smtp.gmail.com&quot;, 
        port = 587, 
        domain = 'gmail.com', 
        user_name =&amp;gt; &quot;login@gmail.com&quot;, 
        password = &quot;passwd&quot;, 
        authentication = :plain 
 }
&lt;/pre&gt;
&lt;p style=&quot;margin-bottom: 0in;&quot;&gt;I use the following code to test different combos until I got it right.&lt;/p&gt;

&lt;pre style=&quot;margin-left: 80px;&quot;&gt;
  require 'rubygems'
  require 'action_mailer'
  require 'smtp_tls'

class SimpleMailer &amp;lt;  ActionMailer::Base
     def simple_message(recipient)
        from 'rubydevtues@gmail.com'
        recipients recipient
        subject 'I just sent this from gmail'
        body 'hope this works'
     end
end

ActionMailer::Base.smtp_settings = {
    :address =&amp;gt; 'smtp.gmail.com',
    :domain =&amp;gt; 'smtp.gmail.com',
    :port =&amp;gt; '587',
    :user_name =&amp;gt; 'phoebe',
    :password =&amp;gt; 'passwd',
    :use_tls =&amp;gt; 'true',
    :authentication =&amp;gt;'plain' }

SimpleMailer.deliver_simple_message('phoebe@address.net')

&lt;/pre&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;/body&gt;
&lt;/html&gt;</body>
  <created-at type="datetime">2009-11-26T19:01:43-08:00</created-at>
  <id type="integer">384445</id>
  <permalink>database-and-actionmailer-configuration-for-bostonrb</permalink>
  <repository-id type="integer">20088</repository-id>
  <title>Database and Actionmailer configuration for Bostonrb</title>
  <updated-at type="datetime">2009-11-04T19:22:01-08:00</updated-at>
  <user-id type="integer">143365</user-id>
</wiki>
