Skip to content

Instantly share code, notes, and snippets.

@mathildathompson
Last active August 29, 2015 13:57
Show Gist options
  • Select an option

  • Save mathildathompson/9720018 to your computer and use it in GitHub Desktop.

Select an option

Save mathildathompson/9720018 to your computer and use it in GitHub Desktop.
rails new emails -d postgresql
rails generate mailer UserMailer
rails generate scaffold user name email
rake db:create
rake db:migrate
initializers/setup_mail.rb or config environments development.rb
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
:address => "smtp.gmail.com", #using the gmail servers;
:port => 587,
:domain => "mathildathompson288@gmail.com", #name of your site
:user_name => "mathildathompson288", #email username
:password => "******", #email password
:authentication => "plain",
:enable_starttls_auto => true
}
#Go into gmail account and into settings, go to forwarding POP/IMAP, enable it and click save changes;
#When you make a change to the config file you have to take down the server as they are only loaded once when the server is started up;
#Gmail does not let you do stylesheets; Styling emails is very difficult;
#Store the email address somewhere else;
ENV #environment variables
echo $PATH #This is an environment variables;
echo $GMAIL_PASSWORD
ENV[GMAIL_PASSWORD]
~/.bash_profile
export GMAIL_PASSWORD= u43jfs
gem 'dotenv-rails', :group => development #loads environemnt variables from .env into the environmane hash;
.env #make sure this never gets committed to Github add it to the Gitignore #Add it to the .gitignore /.env
GMAIL_PASSWORD =
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment