Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

ruby on rails - How to Send Email in Development with Spree

I'm in the development environment and I want to send out test emails via my console. I got the console going nice, but its not sending.

I go to Spree's Mail Method Settings and here's what I got:

Spree Mail Method Settings for BenMorganIO

I've double checked the password. I've Googled the hell out of it. I can't figure out how to get this thing to work.

Key Question: How does one get email working in Spree from the development environment?

Things I Tried: Spree Mail Method is not working?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The problem is that you need a local email server that can receive your emails. To test the setup in development install the mailcatcher gem, that you will use as a SMTP server in development, catching all incoming mails and displaying them on http://localhost:1080/:

Just run in the terminal

gem install mailcatcher

then run mailcatcher in the console. A toy SMTP server will be running on port 1025 catching emails and displaing them on HTTP port 1080.

Then just goto the spree admin panel and configure it. The following settings work perfectly for me without any code writing.

enter image description here

After I clicked on send test mail I got the following email on my localhost:

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...