Question

I have no idea why I'm not able to set my gmail env variable on my heroku server. I ran and set the User name easily according to their docs, by running

heroku config:add GMAIL_USERNAME=usersname@gmail.com

But, now when I try to setup the password to go along with this for my use in the mailer

heroku config:add GMAIL_PASSWORD=mypassword

I'm getting the error

zsh: no matches found: GMAIL_PASSWORD=mypassword

I have no idea why I'm not able to set this variable in this way much less why I'm getting this output from my shell.

A few things about this part of my setup.

-using loca_env.yml for mailer username and password, that is checked into .gitignore (hence setting this on heroku servers.)

The mailer initializer-

ActionMailer::Base.smtp_settings = {
    :enable_starttls_auto => true,
    :address => "smtp.gmail.com",
    :port => "587",
    :domain => "gmail.com",
    :authentication => :plain,
    :user_name => ENV["GMAIL_USERNAME"],
    :password => ENV["GMAIL_PASSWORD"]
}

ActionMailer::Base.default_url_options[:host] = "myapp.herokuapp.com"

It mails fine in local and now I'm trying to test in a production setting without checking in local_env.yml into version control. Something simple I'm not understanding?

Was it helpful?

Solution

You can almost always coax your shell into handling special characters differently. For zsh, try this: heroku config:add X='erwrewr#' The single quotes will ensure most special characters are suppressed.

OTHER TIPS

Something I hadn't considered until messing with it for another 30 min.

My actual password ended in a '#' which was causing my shell error. For anyone finding themselves in this edge case..Not sure what the special characters that won't allow you to set in different shell but something to check if you run across a similar error.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top