Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting SMTP mail properly on my localhost #19

Open
openbooknoobdeveloper opened this issue Nov 12, 2018 · 14 comments
Open

Setting SMTP mail properly on my localhost #19

openbooknoobdeveloper opened this issue Nov 12, 2018 · 14 comments
Labels
Give More Detail 😤 Further information is requested

Comments

@openbooknoobdeveloper
Copy link

hi guys, the project it is working nicely on my local machine, I just got a problem to receive and send emails. to validate accounts.

some guys said to use mail-gun, but i could make it works on my local-machine, any suggestions how to install it and test the email function from my local-machine? thank you.

I have to change the config but I dont know what to put there.

below settings only in production env

system notify mail settings

--------------------------------------------------------------

SMTP_PORT: YOUR_SMTP_PORT
SMTP_DOMAIN: YOUR_SMTP_DOMAIN
SMTP_ADDRESS: YOUR_SMTP_ADDRESS
SMTP_USERNAME: YOUR_SMTP_USERNAME
SMTP_PASSWORD: YOUR_SMTP_PASSWORD
SMTP_AUTHENTICATION: plain # could be plain, login or cram_md5

@algobasket
Copy link
Owner

algobasket commented Nov 12, 2018

@openbooknoobdeveloper Use mailgun and make sure your domain is verified in mailgun and everything is Green . CName,MX and Txt Record all green. After this just place the mailgun smtp settings

SMTP_PORT: 587
SMTP_DOMAIN: Your Domain (example - google.com,yahoo.com)
SMTP_ADDRESS: smtp.mailgun.org
SMTP_USERNAME: YOUR_SMTP_USERNAME
SMTP_PASSWORD: YOUR_SMTP_PASSWORD
SMTP_AUTHENTICATION: plain
Then
inside peatio folder > gem install mail
Then restart Nginx (sudo service nginx restart or sudo /etc/init.d/nginx restart )
👍

@openbooknoobdeveloper
Copy link
Author

thanks a lot @algobasket , I will try do this using a proper server, I was trying to do this on my localmachine so do you have any idea how to this this config this in my localmachine?

as well it is any way to do validate the users email just setting it on the database? thank you.

@algobasket
Copy link
Owner

smtp you can use it on both localhost or live . For localhost do the same as production smtp setting.
validate the users email from the admin.

@algobasket algobasket added the Give More Detail 😤 Further information is requested label Nov 13, 2018
@samqju
Copy link

samqju commented Jan 10, 2019

I own a domain through bigrock and i am having full access to DNS management, I do have SMTP address and all other information provided in application.yml but still i am not able to send emails for account verification.

For mailing purpose Bigrock uses webmail services

@samqju
Copy link

samqju commented Jan 10, 2019

production log seems all is ok apart from that : 302 Found and why it is connecting to 122.160.138.225

I, [2019-01-10T09:55:57.103357 #1438] INFO -- : Started GET "/activations/new" for 122.160.138.225 at 2019-01-10 09:55:57 +$
I, [2019-01-10T09:55:57.107110 #1438] INFO -- : Processing by ActivationsController#new as HTML
I, [2019-01-10T09:55:57.132835 #1438] INFO -- : Redirected to http://159.65.95.38/settings
I, [2019-01-10T09:55:57.133000 #1438] INFO -- : Completed 302 Found in 26ms (ActiveRecord: 3.4ms)
I, [2019-01-10T09:55:57.335619 #1438] INFO -- : Started GET "/settings" for 122.160.138.225 at 2019-01-10 09:55:57 +0000
I, [2019-01-10T09:55:57.336970 #1438] INFO -- : Processing by Private::SettingsController#index as HTML
I, [2019-01-10T09:55:57.351781 #1438] INFO -- : Rendered private/settings/index.html.slim within layouts/application (7.4$
I, [2019-01-10T09:55:57.354776 #1438] INFO -- : Rendered shared/_html5.html.slim (0.1ms)
I, [2019-01-10T09:55:57.355307 #1438] INFO -- : Rendered shared/_meta.html.slim (0.4ms)
I, [2019-01-10T09:55:57.355654 #1438] INFO -- : Rendered shared/_alert.html.slim (0.1ms)
I, [2019-01-10T09:55:57.361389 #1438] INFO -- : Rendered shared/_header_profile_setting.html.slim (4.7ms)
I, [2019-01-10T09:55:57.361616 #1438] INFO -- : Rendered shared/_header_lang_sel.html.slim (0.1ms)
I, [2019-01-10T09:55:57.361686 #1438] INFO -- : Rendered shared/_header.html.slim (5.9ms)
I, [2019-01-10T09:55:57.362135 #1438] INFO -- : Rendered shared/_flash.slim (0.1ms)
I, [2019-01-10T09:55:57.362213 #1438] INFO -- : Rendered shared/_frame.html.slim (0.4ms)
I, [2019-01-10T09:55:57.362332 #1438] INFO -- : Rendered shared/_footer.html.slim (0.0ms)
I, [2019-01-10T09:55:57.362497 #1438] INFO -- : Completed 200 OK in 25ms (Views: 15.9ms | ActiveRecord: 3.0ms)

@dagnyc
Copy link

dagnyc commented Feb 28, 2019

I'm having the same issue. I tried your suggestion to do this:

inside peatio folder > gem install mail
Then restart Nginx (sudo service nginx restart or sudo /etc/init.d/nginx restart )

But emails still don't go out when I try to send a verification email

Not sure what I could be missing. The site is up and running but just can't get the emails going

Any help would be greatly appreciated :)

@algobasket
Copy link
Owner

@dagnyc make sure you verified your domain on Mailgun and CName,MX,TXT all green status

@dagnyc
Copy link

dagnyc commented Mar 1, 2019

@algobasket Thanks for the reply. I did try that with mailgun but there seems to be some kind of syntax discrepancy in ruby. Please see the attached pic. It shows the settings in quotes and with a comma at the end of each line. Could this be why it's not working?

mailgun_ruby_settings

@dagnyc
Copy link

dagnyc commented Mar 1, 2019

this is a screenshot from here https://www.leemunroe.com/send-automated-email-ruby-rails-mailgun/

@algobasket
Copy link
Owner

@dagnyc don't use it here . Use it in application.yml

@dagnyc
Copy link

dagnyc commented Mar 1, 2019

@algobasket yes i am aware of that. I only used that screenshot to show the mailgun settings I'm using. The config was done in config/application.yml.

I'm just going to reinstall everything but it seems that this has become an issue for many people. I'm convinced that there is something missing from the instruction on how to setup the email properly. Something missing about how to get ruby to make the connection the "any" email server at all. Let's see if I get the same result after reinstalling everything

@dagnyc
Copy link

dagnyc commented Mar 1, 2019

something that is obvious to a ruby professional may not be obvious to a beginner

@dagnyc
Copy link

dagnyc commented Mar 17, 2019

@openbooknoobdeveloper Use mailgun and make sure your domain is verified in mailgun and everything is Green . CName,MX and Txt Record all green. After this just place the mailgun smtp settings

SMTP_PORT: 587
SMTP_DOMAIN: Your Domain (example - google.com,yahoo.com)
SMTP_ADDRESS: smtp.mailgun.org
SMTP_USERNAME: YOUR_SMTP_USERNAME
SMTP_PASSWORD: YOUR_SMTP_PASSWORD
SMTP_AUTHENTICATION: plain
Then
inside peatio folder > gem install mail
Then restart Nginx (sudo service nginx restart or sudo /etc/init.d/nginx restart )
👍

As I suspected, it was my lack of experience with Ruby that was giving me trouble. Following the above advice did help. In addition, I found that my daemons were having trouble running due to low resources. Adding a swap file in Ubuntu helped me get the daemons to run consistently without crashing. Secondly, be sure to stop/start your daemons after any configuration changes and after doing

inside peatio folder > gem install mail
Then restart Nginx (sudo service nginx restart or sudo /etc/init.d/nginx restart )

Then, as long as your email settings are configured properly, your mailer will be able to send emails :)

I tested this with both mailgun and with my own email server hosted on a VPS

Feel free to contact me if anyone needs help getting the mailer to work

@pblab-dev

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Give More Detail 😤 Further information is requested
Projects
None yet
Development

No branches or pull requests

5 participants