PeatioCryptoExchange icon indicating copy to clipboard operation
PeatioCryptoExchange copied to clipboard

Setting SMTP mail properly on my localhost

Open openbooknoobdeveloper opened this issue 5 years ago • 14 comments

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

openbooknoobdeveloper avatar Nov 12 '18 16:11 openbooknoobdeveloper

@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 ) :+1:

algobasket avatar Nov 12 '18 20:11 algobasket

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.

openbooknoobdeveloper avatar Nov 12 '18 20:11 openbooknoobdeveloper

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 avatar Nov 12 '18 20:11 algobasket

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 avatar Jan 10 '19 09:01 samqju

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)

samqju avatar Jan 10 '19 09:01 samqju

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 :)

dagnyc avatar Feb 28 '19 14:02 dagnyc

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

algobasket avatar Feb 28 '19 21:02 algobasket

@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 avatar Mar 01 '19 04:03 dagnyc

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

dagnyc avatar Mar 01 '19 04:03 dagnyc

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

algobasket avatar Mar 01 '19 08:03 algobasket

@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 avatar Mar 01 '19 10:03 dagnyc

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

dagnyc avatar Mar 01 '19 10:03 dagnyc

@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

dagnyc avatar Mar 17 '19 19:03 dagnyc

It's hard to find information, I suggest you see this https://bitcointalk.org/index.php?topic=5202005.new#new

pblab-dev avatar Nov 16 '19 14:11 pblab-dev