forem / selfhost

Selfhost your Forem Community on your own infrastructure 🎉
https://www.forem.com/get-started/
GNU Affero General Public License v3.0
1.43k stars 169 forks source link

SMTP email service is not working #76

Open evojewel opened 1 year ago

evojewel commented 1 year ago

Configured Email Server Settings (SMTP) from from admin panel through Customization/Config with mailgun as service provider. After inviting a member it showed "The invite has been sent to the user's email." but the email did not received and in backend there is a timeout error happening

Steps to reproduce the behaviour :

  1. Go to '/admin/customization/config'
  2. Configured Email Server Settings (SMTP) with mailgun as service provider (Authentication:Plain, Port:465)
  3. Got to '/admin/member_manager/invitations/new' submit email address and it will show the email was sent
  4. Go to the instance console of your cloud provider where the forem is hosted and hit 'journalctl -f -u forem-rails.service' there will be a timeout error
  5. Error log : Error log.txt

Expected behaviour : The email should receive

OS : Linux

Cloud Provider : AWS

Additional context : Tried with Sendgrid and same timeout error is occurring, Changing port is not making any changes

maestromac commented 1 year ago

Hello there, I'm not sure how much this matters but could you please try lowercase plain and restart the server? What did you use for the mailgun address?

evojewel commented 1 year ago

@maestromac It is already plain and the address is smtp.eu.mailgun.org

maestromac commented 1 year ago

What's your from and reply email address? I see the following email in your log 636cc6a550364_b482c49753c@forem-pod.mail which looks like an autogenerated email address.

Dani4kor commented 1 year ago

any updates? got same problem

igrir commented 1 year ago

I also have the some problem, after testing out 'journalctl -f -u forem-rails.service' it also print out this error:

ERROR -- : [ActiveJob] [ActionMailer::MailDeliveryJob] [4126839f-55da-4ac1-874d-cbff56dfe42f] Error performing ActionMailer::MailDeliveryJob (Job ID: 4126839f-55da-4ac1-874d-cbff56dfe42f) from Async(default) in 5033.56ms: Net::ReadTimeout (Net::ReadTimeout with #<Socket:(closed)>):
maestromac commented 1 year ago

@Dani4kor @igrir may I please know which email services are you both using?

igrir commented 1 year ago

@Dani4kor @igrir may I please know which email services are you both using?

I am using mailgun, I tried all the ports and the result is the same. I also tried to use Amazon's SES and looks like it also return the same error

igrir commented 1 year ago

this is the result from my journalctl logs

May 16 04:08:45 www.gimid.dev forem-rails[239274]: I, [2023-05-16T04:08:45.003233 #7]  INFO -- : [eb1eadd0-1e6b-4ba9-aa33-2d22f43cf6db] [dd.env=production dd.service=rails-production dd.trace_id=1537542653877818210 dd.span_id=0] Started POST "/admin/member_manager/users/3/send_email" for 185.213.83.248 at 2023-05-16 04:08:45 +0000
May 16 04:08:45 www.gimid.dev forem-rails[239274]: I, [2023-05-16T04:08:45.015927 #7]  INFO -- : [eb1eadd0-1e6b-4ba9-aa33-2d22f43cf6db] [dd.env=production dd.service=rails-production dd.trace_id=1537542653877818210 dd.span_id=0] Processing by Admin::UsersController#send_email as HTML
May 16 04:08:45 www.gimid.dev forem-rails[239274]: I, [2023-05-16T04:08:45.016738 #7]  INFO -- : [eb1eadd0-1e6b-4ba9-aa33-2d22f43cf6db] [dd.env=production dd.service=rails-production dd.trace_id=1537542653877818210 dd.span_id=0]   Parameters: {"utf8"=>"✓", "authenticity_token"=>"[FILTERED]", "user_id"=>"3", "email_subject"=>"[FILTERED]", "email_body"=>"[FILTERED]", "button"=>"[FILTERED]", "locale"=>nil, "id"=>"3"}
May 16 04:08:45 www.gimid.dev forem-rails[239274]: I, [2023-05-16T04:08:45.031756 #7]  INFO -- : [eb1eadd0-1e6b-4ba9-aa33-2d22f43cf6db] [dd.env=production dd.service=rails-production dd.trace_id=1537542653877818210 dd.span_id=0]   Rendered mailers/notify_mailer/user_contact_email.html.erb within layouts/mailer (Duration: 0.5ms | Allocations: 175)
May 16 04:08:45 www.gimid.dev forem-rails[239274]: I, [2023-05-16T04:08:45.041357 #7]  INFO -- : [eb1eadd0-1e6b-4ba9-aa33-2d22f43cf6db] [dd.env=production dd.service=rails-production dd.trace_id=1537542653877818210 dd.span_id=0]   Rendered layout layouts/mailer.html.erb (Duration: 10.1ms | Allocations: 1796)
May 16 04:08:45 www.gimid.dev forem-rails[239274]: I, [2023-05-16T04:08:45.042816 #7]  INFO -- : [eb1eadd0-1e6b-4ba9-aa33-2d22f43cf6db] [dd.env=production dd.service=rails-production dd.trace_id=1537542653877818210 dd.span_id=0]   Rendered mailers/notify_mailer/user_contact_email.text.erb within layouts/mailer (Duration: 0.3ms | Allocations: 35)
May 16 04:08:45 www.gimid.dev forem-rails[239274]: I, [2023-05-16T04:08:45.043760 #7]  INFO -- : [eb1eadd0-1e6b-4ba9-aa33-2d22f43cf6db] [dd.env=production dd.service=rails-production dd.trace_id=1537542653877818210 dd.span_id=0]   Rendered layout layouts/mailer.text.erb (Duration: 1.2ms | Allocations: 160)
May 16 04:08:50 www.gimid.dev forem-rails[239274]: I, [2023-05-16T04:08:50.062942 #7]  INFO -- : [eb1eadd0-1e6b-4ba9-aa33-2d22f43cf6db] [dd.env=production dd.service=rails-production dd.trace_id=1537542653877818210 dd.span_id=0] Delivered mail 646301cdbc34_748ee08285e@forem-pod.mail (5015.7ms)
May 16 04:08:50 www.gimid.dev forem-rails[239274]: I, [2023-05-16T04:08:50.065530 #7]  INFO -- : [eb1eadd0-1e6b-4ba9-aa33-2d22f43cf6db] [dd.env=production dd.service=rails-production dd.trace_id=1537542653877818210 dd.span_id=0] Completed 500 Internal Server Error in 5048ms (ActiveRecord: 2.8ms | Allocations: 9262)
May 16 04:08:50 www.gimid.dev forem-rails[239274]: F, [2023-05-16T04:08:50.067642 #7] FATAL -- : [eb1eadd0-1e6b-4ba9-aa33-2d22f43cf6db] [dd.env=production dd.service=rails-production dd.trace_id=1537542653877818210 dd.span_id=0]
May 16 04:08:50 www.gimid.dev forem-rails[239274]: [eb1eadd0-1e6b-4ba9-aa33-2d22f43cf6db] [dd.env=production dd.service=rails-production dd.trace_id=1537542653877818210 dd.span_id=0] Net::ReadTimeout (Net::ReadTimeout with #<Socket:(closed)>):
May 16 04:08:50 www.gimid.dev forem-rails[239274]: [eb1eadd0-1e6b-4ba9-aa33-2d22f43cf6db] [dd.env=production dd.service=rails-production dd.trace_id=1537542653877818210 dd.span_id=0]
May 16 04:08:50 www.gimid.dev forem-rails[239274]: [eb1eadd0-1e6b-4ba9-aa33-2d22f43cf6db] [dd.env=production dd.service=rails-production dd.trace_id=1537542653877818210 dd.span_id=0] app/controllers/admin/users_controller.rb:258:in `send_email'
May 16 04:08:50 www.gimid.dev forem-rails[239274]: [eb1eadd0-1e6b-4ba9-aa33-2d22f43cf6db] [dd.env=production dd.service=rails-production dd.trace_id=1537542653877818210 dd.span_id=0] app/lib/middlewares/set_cookie_domain.rb:12:in `call'
May 16 04:08:50 www.gimid.dev forem-rails[239274]: E, [2023-05-16T04:08:50.074478 #7] ERROR -- honeybadger: ** [Honeybadger] Unable to send error report: API key is missing. id=ed8742be-78b2-479f-a995-25783eec945f level=3 pid=7