# Logstash smtp configuration

**URL:** <https://discuss.elastic.co/t/logstash-smtp-configuration/28862>\
**Category:** Logstash\
**Created:** [September 8, 2015, 6:39pm UTC](https://discuss.elastic.co/t/logstash-smtp-configuration/28862 "2015-09-08T18:39:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jalen\_wang](https://avatars.discourse-cdn.com/v4/letter/j/22d042/32.png) [@jalen\_wang](https://discuss.elastic.co/u/jalen_wang)\
**Post date:** [September 8, 2015, 6:39pm UTC](https://discuss.elastic.co/t/logstash-smtp-configuration/28862/1 "2015-09-08T18:39:15Z")

</div>

Hi

I want to config logstash output to email by smtp,but it always goes wrong,this is my configuration:

```auto
email {
  to => "xxx@xxx.com.cn"
  codec => "plain"
  contenttype => "text/html; charset=UTF-8"
  options => {
    smtpIporHost => "smtp.xxx.com.cn"
    port => 465
    userName => "xxx@xxx.com.cn"
    password => "xxx"
    starttls => true
  }
}

```

Error message:

```auto
Net::SMTPServerBusy: 440 mail from account doesn't conform with authentication (Auth Account:zhibin.wang@eproe.com.cn|Mail Account:logstash.alert@nowhere.com)

  check_response at /opt/logstash/vendor/jruby/lib/ruby/1.9/net/smtp.rb:949
           getok at /opt/logstash/vendor/jruby/lib/ruby/1.9/net/smtp.rb:918
        mailfrom at /opt/logstash/vendor/jruby/lib/ruby/1.9/net/smtp.rb:833
    send_message at /opt/logstash/vendor/jruby/lib/ruby/1.9/net/smtp.rb:660
        deliver! at /opt/logstash/vendor/bundle/jruby/1.9/gems/mail-2.6.3/lib/mail/network/delivery_methods/smtp.rb:113
           start at /opt/logstash/vendor/jruby/lib/ruby/1.9/net/smtp.rb:521
        deliver! at /opt/logstash/vendor/bundle/jruby/1.9/gems/mail-2.6.3/lib/mail/network/delivery_methods/smtp.rb:112
        deliver! at /opt/logstash/vendor/bundle/jruby/1.9/gems/mail-2.6.3/lib/mail/message.rb:252
         receive at /opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-output-email-1.0.0/lib/logstash/outputs/email.rb:250
          handle at /opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-1.5.4-java/lib/logstash/outputs/base.rb:88
     output_func at (eval):52
    outputworker at /opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-1.5.4-java/lib/logstash/pipeline.rb:244
   start_outputs at /opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-1.5.4-java/lib/logstash/pipeline.rb:166

```

if anyone could help me to resolve that issues?

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [September 8, 2015, 6:58pm UTC](https://discuss.elastic.co/t/logstash-smtp-configuration/28862/2 "2015-09-08T18:58:37Z")

</div>

The error message,

> 440 mail from account doesn't conform with authentication (Auth Account:zhibin.wang@eproe.com.cn|Mail [Account:logstash.alert@nowhere.com](mailto:Account:logstash.alert@nowhere.com))

indicates that the SMTP relay wants the SMTP envelope sender address to match the username used for authentication. So, use the plugin's `from` parameter to change the sender address to [zhibin.wang@eproe.com.cn](mailto:zhibin.wang@eproe.com.cn).

Keep in mind that if Logstash ever has problems sending email that'll halt the whole pipeline (which you perhaps already have discovered). I suggest that you let Logstash offload messages to localhost or some internal SMTP relay so that it doesn't interfere with Logstash's logging pipeline.

(Port 465 is normally SMTP over SSL while the `starttls` is for STARTTLS which is usually port 25 or 587. I'm somewhat surprised this appears to work as well as it does.)

---

<div class="post-metadata">

**Author:** ![jalen\_wang](https://avatars.discourse-cdn.com/v4/letter/j/22d042/32.png) [@jalen\_wang](https://discuss.elastic.co/u/jalen_wang)\
**Post date:** [September 8, 2015, 7:17pm UTC](https://discuss.elastic.co/t/logstash-smtp-configuration/28862/3 "2015-09-08T19:17:14Z")

</div>

thanks very much! logstash has successed to send mail by add `from` parameter.

i knew this will cause the whole events will be sended by email,i‘m just verifying the function of email alert and just a few messages,later i will build my alarm logic to check which pipeline should send out from email.

thanks!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 5:29am UTC](https://discuss.elastic.co/t/logstash-smtp-configuration/28862/5 "2017-07-06T05:29:43Z")

</div>


