Net::SMTPServerBusy exception

AI-generated summary

The discussion revolves around resolving a Net::SMTPServerBusy exception error. Hyan encountered the issue while trying to download website backups and send emails, which resulted in queued emails. The error log showed SMTP-related errors. pfaffman suggested that the problem lies with the SMTP server. Upon further investigation, Hyan discovered that the site’s migration from an old site had resulted in users having invalid email addresses, such as **909471255bcde5900c628c6@email.invalid**. However, this was not the primary cause of the issue. After running ./discourse-doctor and resolving the SMTP errors, Hyan was able to send emails successfully, and the queued emails were also sent.

I was trying to download website backups from /admin/backups and I cannot receive download emails. After checking production.log I found following output

Started PUT "/admin/backups/xxx.tar.gz" for 203.18.50.6 at 2023-05-08 05:34:50 +0000
Processing by Admin::BackupsController#email as */*
  Parameters: {"id"=>"xxx.tar.gz"}
start
  Rendered text template (Duration: 0.0ms | Allocations: 1)
Completed 200 OK in 658ms (Views: 3.7ms | ActiveRecord: 0.0ms | Allocations: 11718)
  Rendered layouts/email_template.html.erb (Duration: 2.6ms | Allocations: 36)
Job exception: Net::SMTPServerBusy

fail

There’s also similar errors related to SMTP, such as below

start
  Rendered user_notifications/digest.html.erb within layouts/email_template (Duration: 26.5ms | Allocations: 3067)
  Rendered layout layouts/email_template.html.erb (Duration: 35.6ms | Allocations: 3335)
  Rendered user_notifications/digest.text.erb (Duration: 19.6ms | Allocations: 2594)
Job exception: Net::SMTPServerBusy

Job exception: unexpected return

fail

The site was migrated from an old other site, and there’re many users email formatted as
909471255bcde5900c628c6@email.invalid

Can someone give me a clue what’s the cause of the issue and how can I resolve that?

Something is wrong with your smtp server. You’ll need to fix it.

Those users had invalid (perhaps empty) email addresses, so the import script created a bogus one. There’s not much you can do to fix that.

Turns out it’s related to my SMTP server. After verifying it with ./discourse-doctor and resolved the SMTP errors. I can send emails now and those queued emails are sent as well.

Thanks your always help @pfaffman