Relocation of server caused e-mail send out to fail



Long time Discourse user here, never had any issues. Relocated the server today but booted up at the new location without any issues, everything working smoothly until I tested sending an e-mail. I get this stack trace:

/usr/local/lib/ruby/2.3.0/net/smtp.rb:542:in `initialize'
/usr/local/lib/ruby/2.3.0/net/smtp.rb:542:in `open'
/usr/local/lib/ruby/2.3.0/net/smtp.rb:542:in `tcp_socket'
/usr/local/lib/ruby/2.3.0/net/smtp.rb:552:in `block in do_start'
/usr/local/lib/ruby/2.3.0/timeout.rb:101:in `timeout'
/usr/local/lib/ruby/2.3.0/net/smtp.rb:551:in `do_start'
/usr/local/lib/ruby/2.3.0/net/smtp.rb:521:in `start'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/mail-2.6.5/lib/mail/network/delivery_methods/smtp.rb:113:in `deliver!'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/mail-2.6.5/lib/mail/message.rb:2149:in `do_delivery'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/mail-2.6.5/lib/mail/message.rb:237:in `block in deliver'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/actionmailer-4.2.8/lib/action_mailer/base.rb:543:in `block in deliver_mail'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.8/lib/active_support/notifications.rb:164:in `block in instrument'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.8/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.8/lib/active_support/notifications.rb:164:in `instrument'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/actionmailer-4.2.8/lib/action_mailer/base.rb:541:in `deliver_mail'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/mail-2.6.5/lib/mail/message.rb:237:in `deliver'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/actionmailer-4.2.8/lib/action_mailer/message_delivery.rb:85:in `deliver_now'
/var/www/discourse/lib/email/sender.rb:184:in `send'
/var/www/discourse/app/jobs/regular/user_email.rb:41:in `execute'
/var/www/discourse/app/jobs/regular/critical_user_email.rb:10:in `execute'
/var/www/discourse/app/jobs/base.rb:154:in `block (2 levels) in perform'

We’re running a local SMTP server for the delivery but that has worked flawlessly until the reboot. I have a hard time understanding the logs here, does anyone have any idea?

(Stephen) #2

Relocated from where to where? I’m assuming it’s a VM, but did it move between physical hosts? Hosting environments? Can you elaborate?

A lot happens besides a “reboot” when a machine is moved, most of which isn’t related to Discourse, but we can probably help pin down where to begin looking.


From one physical address to another, i.e. moved it a few blocks. New IP, new ISP and so forth… yes, 100% sure, we have multiple send outs per day.

(Stephen) #4

Ok, how are you referencing to the local SMTP server in your app.yml? Is the SMTP server running on the same machine, or local in the sense of same-subnet? Do any other services use that SMTP instance?

Have you ruled out network ACLs leaving the network?

If possible I would suggest sending email manually using the SMTP server to eliminate it as a potential cause before pointing the finger at Discourse. Discourse is very much set-and-forget for outbound mail.

(Matt Palmer) #5

The e-mail troubleshooting howto is your friend.


Yeah, turns out it had nothing to do with Discourse as usual (I should stop pointing the finger). When booting up the server at the new location iptables was reset and no longer accepting connections from a Docker container, solved it by running:

iptables -A INPUT -i docker0 -j ACCEPT

Found it by trying to telnet to the parent host from inside the container so the e-mail troubleshooting howto did send me on the correct path. Shame I didn’t look at it first but hopefully now someone with the same issue and stack trace can find this.

Thanks for your support! Discourse rules! :slight_smile:

(Matt Palmer) #7