SocketError: getaddrinfo: Name or service not known

I trying to configure the email notification in gitlab. I changed below stuff in gitlab.rb file

  #mail notification configuration
  #external_url "https://gitlab.example.com/"
  gitlab_rails['gitlab_email_from'] = "example@domian.com"
  #gitlab_rails['gitlab_support_email'] = "example@domian.com"
  gitlab_rails['smtp_enable'] = true
  gitlab_rails['smtp_address'] = "email-smtp.us-east-1 .amazonaws.com"
  gitlab_rails['smtp_port'] = 587
  gitlab_rails['smtp_user_name'] = "DSYJDKXXXXIFNVR"
  gitlab_rails['smtp_password'] = "skvshkishncusklchskgvuscsiksjvyslskvslvksvsjvsjvnskjvsjvbfv"
  gitlab_rails['smtp_domain'] = "example.com"
  gitlab_rails['smtp_authentication'] = "login"
  gitlab_rails['smtp_enable_starttls_auto'] = true
  #gitlab_rails['smtp_openssl_verify_mode'] = 'peer'

After reconfigure my server I tried to get the sample mail by using below command

Notify.test_email('user@mail.com', 'Message Subject', 'Message Body').deliver_now

But i get the exception

  Notify#test_email: processed outbound mail in 317.5ms

  Sent mail to user@mail.com (68.1ms)
  Date: Wed, 25 Jan 2017 08:56:08 +0000
  From: GitLab <from@mail.com>
  Reply-To: GitLab <noreply@gitlab.syncfusion.com>
  To: user@mail.com
  Message-ID: <58753928a22e6_27353fa37b8cd11c187e9@gitlab-32gb-blr1-01.mail>
  Subject: Message Subject
  Mime-Version: 1.0
  Content-Type: text/html;
  charset=UTF-8
  Content-Transfer-Encoding: 7bit

  <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
  <html><body><p>Message Body</p></body></html>

  SocketError: getaddrinfo: Name or service not known
  from /opt/gitlab/embedded/lib/ruby/2.3.0/net/smtp.rb:542:in `initialize'
  from /opt/gitlab/embedded/lib/ruby/2.3.0/net/smtp.rb:542:in `open'
  from /opt/gitlab/embedded/lib/ruby/2.3.0/net/smtp.rb:542:in `tcp_socket'
  from /opt/gitlab/embedded/lib/ruby/2.3.0/net/smtp.rb:552:in `block in do_start'
  from /opt/gitlab/embedded/lib/ruby/2.3.0/timeout.rb:91:in `block in timeout'
  from /opt/gitlab/embedded/lib/ruby/2.3.0/timeout.rb:101:in `timeout'
  from /opt/gitlab/embedded/lib/ruby/2.3.0/net/smtp.rb:551:in `do_start'
  from /opt/gitlab/embedded/lib/ruby/2.3.0/net/smtp.rb:521:in `start'
  from /opt/gitlab/embedded/service/gitlab-rails/vendor/bundle/ruby/2.3.0/gems/mail-2.6.4/lib/mail/network/delivery_methods/smtp.rb:113:in `deliver!'
  from /opt/gitlab/embedded/service/gitlab-rails/vendor/bundle/ruby/2.3.0/gems/mail-2.6.4/lib/mail/message.rb:2149:in `do_delivery'
  from /opt/gitlab/embedded/service/gitlab-rails/vendor/bundle/ruby/2.3.0/gems/mail-2.6.4/lib/mail/message.rb:237:in `block in deliver'
  from /opt/gitlab/embedded/service/gitlab-rails/vendor/bundle/ruby/2.3.0/gems/actionmailer-4.2.7.1/lib/action_mailer/base.rb:543:in `block in deliver_mail'
  from /opt/gitlab/embedded/service/gitlab-rails/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/notifications.rb:164:in `block in instrument'
  from /opt/gitlab/embedded/service/gitlab-rails/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
  from /opt/gitlab/embedded/service/gitlab-rails/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/notifications.rb:164:in `instrument'
  from /opt/gitlab/embedded/service/gitlab-rails/vendor/bundle/ruby/2.3.0/gems/actionmailer-4.2.7.1/lib/action_mailer/base.rb:541:in `deliver_mail'
  from /opt/gitlab/embedded/service/gitlab-rails/vendor/bundle/ruby/2.3.0/gems/mail-2.6.4/lib/mail/message.rb:237:in `deliver'
  from /opt/gitlab/embedded/service/gitlab-rails/vendor/bundle/ruby/2.3.0/gems/actionmailer-4.2.7.1/lib/action_mailer/message_delivery.rb:85:in `deliver_now'
  from (irb):1
  from /opt/gitlab/embedded/service/gitlab-rails/vendor/bundle/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/commands/console.rb:110:in `start'
  from /opt/gitlab/embedded/service/gitlab-rails/vendor/bundle/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/commands/console.rb:9:in `start'
  from /opt/gitlab/embedded/service/gitlab-rails/vendor/bundle/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/commands/commands_tasks.rb:68:in `console'
  from /opt/gitlab/embedded/service/gitlab-rails/vendor/bundle/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
  from /opt/gitlab/embedded/service/gitlab-rails/vendor/bundle/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/commands.rb:17:in `<top (required)>'
  from bin/rails:9:in `require'
  from bin/rails:9:in `<main>'

I didn’t receive the mail! What and where I did a mistake?
How can I get the gitlab notification?

Hello, i have the same issue does you can find an answer?

That would generally indicate that either you mis-typed the SMTP server, the SMTP server you’re using doesn’t exist, or your server hasn’t configured the DNS resolvers correctly.

Liam

1 Like

Create the amazon key by following the user guide. Or else it doesn’t works. That`s how I fixed the issue.

1 Like

Hi ,

I had the same problem , had typo in the smtp server anme , please correct iot and it will work

ijaz

1 Like