Note that there are some explanatory texts on larger screens.

plurals
  1. POenv['GMAIL_USERNAME'] not being read by rails app
    text
    copied!<p>so I am trying to send an email when someone fills out a contact us form but when i add:</p> <pre><code>export GMAIL_USERNAME="myapp@domain.com" export GMAIL_PASSWORD="secret" </code></pre> <p>to my </p> <pre><code>~/.bashrc </code></pre> <p>file, and set my <code>development.rb</code> file as below, my app returns a </p> <pre><code>Net::SMTPAuthenticationError 530-5.5.1 Authentication Required </code></pre> <p>but when i replace <code>ENV["GMAIL_USERNAME"]</code> &amp; <code>ENV["GMAIL_PASSWORD"]</code> in <code>development.rb</code> with it's actual values, then i get no problem sending email. doesn't the addition to the <code>~./bashrc</code> file ensure that <code>ENV["GMAIL_USERNAME"]</code> &amp; <code>ENV["GMAIL_PASSWORD"]</code> get replaced with the real values? could someone please help??</p> <p>i've tried <a href="https://support.google.com/mail/bin/answer.py?hl=en&amp;answer=14257" rel="nofollow">google's instructions</a>, but it doesn't work when i use <code>ENV["GMAIL_USERNAME"]</code> &amp; <code>ENV["GMAIL_PASSWORD"]</code> (as opposed to their actual values).</p> <p>here is the relevant part of my <code>development.rb</code> file:</p> <pre><code> # Raise error if the mailer can't send config.action_mailer.raise_delivery_errors = true config.action_mailer.perform_deliveries = true config.action_mailer.default :charset =&gt; "utf-8" # Use SMTP to send mail config.action_mailer.delivery_method = :smtp # Use awesomeness@novulty.com (google app) to send smtp mail config.action_mailer.smtp_settings = { :address =&gt; "smtp.gmail.com", :port =&gt; 587, :domain =&gt; "domain", # real domain name in my file :user_name =&gt; ENV["GMAIL_USERNAME"], :password =&gt; ENV["GMAIL_PASSWORD"], :authentication =&gt; :plain, :enable_starttls_auto =&gt; true } # Specify what domain to use for mailer URLs config.action_mailer.default_url_options = { host: "localhost:3000" } </code></pre> <p>thanks!</p> <h2>UPDATED</h2> <p>my .bashrc file looks like this:</p> <pre><code>PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting export GMAIL_USERNAME=*********** export GMAIL_PASSWORD=*********** </code></pre> <p>but when i open the terminal and input <code>env</code>, the <code>GMAIL_*</code> variables don't get listed but the rvm is added to the <code>PATH</code>. this is bothering me... haha.</p> <p>thanks again!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload