Build a Store With a Payment Gateway in Rails: Problems

I’m stuck on the “Notify Users” portion of this tutorial.

I’ve set up the environmental SMTP variables as demonstrated, but when I enter “echo $SMTP_” in the terminal, the variables don’t print out. It’s just blank. Am I missing something here? It seems like the instructor is just setting them to a blank string and getting it to work. Am I supposed to be entering something? This is extremely unclear in the tutorial.

Thus, when I try to submit an order, I get the following error:

Connection refused - connect(2) for “” port 25

Any help would be greatly appreciated because googling has not worked.

Ask your question here:

Hi @unprevailing! Good question. Maybe @josemota, the course instructor, might be able to help you with this one?

Hi @unprevailing, thanks for posting your question.

In the video, I mentioned you should close the terminal window and create a new one so the variables would be accessible.

One thing comes to mind: are you using zsh or bash? If you’re using the latter, then the file to edit should be either ~/.bashrc or ~/.bash_profile. Look the correct one up with the following command in the terminal: ls -la ~ | grep bash`

Let me know okay? I’ll be in touch.

Hi, @josemota, thank you for the quick response.

I used bash instead of zsh, and entered the following into my .bash_profile:

export SMTP_USER=""
export SMTP_ADDRESS=""

I actually restarted my computer a few times after I saved the file, but the variables don’t print when I enter echo $SMTP_ and instead I get a blank line. It’s very odd because I have other items in my .bash_profile and those work fine.

Here is the error I get from the server:

Completed 500 Internal Server Error in 490ms (ActiveRecord: 13.6ms)

SocketError (getaddrinfo: nodename nor servname provided, or not known):
app/controllers/orders_controller.rb:20:in notify_user
app/controllers/orders_controller.rb:10:in create

I copy/pasted the above files from the Github repo, so there are no typos. I’m sort of at a loss for how to proceed. Should I just skip over the “Notify” lesson and move on?

Thank you.

Hi, @josemota, thanks for your excellent course Build Store. I like to remove a row from cart. would u please show me the code how can i implement it ? I like to make the complete cart for real application following your application. thanks.

Forgive me for sounding condescending, but did you write the values for the variables? I realize you’re showing me empty strings. Just want to clear that out.

As for the lesson being skipped, sure; I don’t see why not. :slight_smile:

As I stated in my original post, I specifically asked whether or not the variables were supposed to be set to an empty string. I’m not getting this out of nowhere; this is literally what it shows in your tutorial:

I tried assigning the variables to my gmail credentials, and this time I received a 500 Internal Server Error.

Completed 500 Internal Server Error in 30102ms (ActiveRecord: 5.4ms)

Net::OpenTimeout (execution expired):

You’re supposed to enter the credentials for your email account. For example:

export SMTP_USER=""
export SMTP_PASSWORD="mypassword"
export SMTP_ADDRESS=""

The reason I left empty strings in there is because I didn’t want to publish sensitive data into the video. I apologize if I didn’t make myself clear on that topic.

Let me know if you sorted it out.

I think a statement like, “Fill in the strings with the credentials for the account you’re using to send the email” would’ve saved me, and probably others, a great deal of time and confusion.

For anyone who uses Gmail, I had to make the following changes to development.rb and .bash_profile to get it to work:

port: 587,
authentication: :login

export SMTP_ADDRESS=""

As a sidebar, I’ve noticed that if you increase the quantity of an item, it still only shows up as 1 item in the cart. (ie, “You have 1 item” when you actually have 3).

Thanks for reporting back with those findings, @unprevailing. I’ll add an annotation to that video to help other students avoid the same problem!