# Issue when sending email alert on some particular event using gmail smtp server

**URL:** <https://discuss.elastic.co/t/issue-when-sending-email-alert-on-some-particular-event-using-gmail-smtp-server/57306>\
**Category:** Logstash\
**Created:** [August 5, 2016, 5:28am UTC](https://discuss.elastic.co/t/issue-when-sending-email-alert-on-some-particular-event-using-gmail-smtp-server/57306 "2016-08-05T05:28:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![r1kumar](https://avatars.discourse-cdn.com/v4/letter/r/aca169/32.png) [@r1kumar](https://discuss.elastic.co/u/r1kumar)\
**Post date:** [August 5, 2016, 5:28am UTC](https://discuss.elastic.co/t/issue-when-sending-email-alert-on-some-particular-event-using-gmail-smtp-server/57306/1 "2016-08-05T05:28:46Z")

</div>

Hi,

I am facing problem when trying to send email alert on particular event using gmail smtp,  
Below is my email configuration inside output block following exception.

```
	output {
			email {
				 port => 587
				 address => "smtp.gmail.com"
				 username => "bra_vinay@gmail.com"
				 password => "mypassword
				 authentication => "login"
				 use_tls => true
				 from => "bra_vinay@gmail.com"
				 subject => "logstash alert"
				 to => "vikumar@bravurasolutions.com"
				 via => "smtp"
				 body => "Here is the event line that occured"
				 debug => true
			}
	}

```

Exception:  
←[31mSomething happen while delivering an email {:exception=\>#\<Net::SMTPAuthenticationError: 530 5.7.0 Must issue a STARTTLS command first. ty6sm9782236pac.18 - gsmtp

> , :level=\>:error}←[0m

After enabling the use\_tls = true in my configuration

email {  
port =\> 587  
address =\> "[smtp.gmail.com](http://smtp.gmail.com)"  
username =\> "[bra\_vinay@gmail.com](mailto:bra_vinay@gmail.com)"  
password =\> "duster123"  
authentication =\> "plain"  
use\_tls =\> true  
from =\> "[bra\_vinay@gmail.com](mailto:bra_vinay@gmail.com)"  
subject =\> "logstash alert"  
to =\> "[vikumar@bravurasolutions.com](mailto:vikumar@bravurasolutions.com)"  
via =\> "smtp"  
body =\> "Here is the event line that occured"  
debug =\> true  
}

E:\Code\_Athon\Setups\logstash-2.3.4\logstash-2.3.4\bin\>logstash -f bra\_login.conf  
i←[31mSomething happen while delivering an email {:exception=\>#\<Net::SMTPAuthenticationError: 535-5.7.8 Username and Password not accepted. Learn more at

> , :level=\>:error}←[0m

Setting authentication method as login instead of plain

email {  
port =\> 587  
address =\> "[smtp.gmail.com](http://smtp.gmail.com)"  
username =\> "[bra\_vinay@gmail.com](mailto:bra_vinay@gmail.com)"  
password =\> "mypassword  
authentication =\> "login"  
use\_tls =\> true  
from =\> "[bra\_vinay@gmail.com](mailto:bra_vinay@gmail.com)"  
subject =\> "logstash alert"  
to =\> "[vikumar@bravurasolutions.com](mailto:vikumar@bravurasolutions.com)"  
via =\> "smtp"  
body =\> "Here is the event line that occured"  
debug =\> true  
}

E:\Code\_Athon\Setups\logstash-2.3.4\logstash-2.3.4\bin\>logstash -f bra\_login.conf  
io/console not supported; tty will not be manipulated  
Settings: Default pipeline workers: 4  
Pipeline main started  
←[31mSomething happen while delivering an email {:exception=\>#\<Net::SMTPAuthenticationError: 535-5.7.8 Username and Password not accepted. Learn more at

> , :level=\>:error}←[0m

Setting authentication method as login instead of plain

email {  
port =\> 587  
address =\> "[smtp.gmail.com](http://smtp.gmail.com)"  
username =\> "[bra\_vinay@gmail.com](mailto:bra_vinay@gmail.com)"  
password =\> "mypassword  
authentication =\> "login"  
use\_tls =\> true  
from =\> "[bra\_vinay@gmail.com](mailto:bra_vinay@gmail.com)"  
subject =\> "logstash alert"  
to =\> "[vikumar@bravurasolutions.com](mailto:vikumar@bravurasolutions.com)"  
via =\> "smtp"  
body =\> "Here is the event line that occured"  
debug =\> true  
}

E:\Code\_Athon\Setups\logstash-2.3.4\logstash-2.3.4\bin\>logstash -f bra\_login.conf  
io/console not supported; tty will not be manipulated  
Settings: Default pipeline workers: 4  
Pipeline main started  
←[31mSomething happen while delivering an email {:exception=\>#\<Net::SMTPAuthenticationError: 535-5.7.8 Username and Password not accepted. Learn more at

> , :level=\>:error}←[0m

With below system configuration:

1 Version: logstash2.3.4  
2 Operating System:Microsoft Windows 8.1 Enterprise 6.3.9600 N/A Build 9600 -Java version : java version "1.7.0\_65" Java(TM) SE Runtime Environment (build 1.7.0\_65-b19) Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)  
3 Config File (if you have sensitive info, please remove it): Please refer sample data section  
4 Sample Data: I am attaching all the configurations I have tried various configuration settings for email but no setting is working our for me. PFA file Sendloginconfiguration.txt for 1 sample configuration PFA file user\_scenarios.txt for all other sample configurations and errors we are getting.  
5 Steps to Reproduce:  
6 Create a logstash configuration file after configuring e-mail options  
7 Start the logstash to read the logs  
8 Logstash will read the logs as expected and do apply the GROK as well , no issues till this point.  
9 Try sending e-mail on all the events , I have not used any IF constraints to restrict e-mail delivery, as I am at very beginning level

Any help would be much appreciated.

Thanks & Regards,  
Rahul Kumar.

---

<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:** [August 8, 2016, 3:43pm UTC](https://discuss.elastic.co/t/issue-when-sending-email-alert-on-some-particular-event-using-gmail-smtp-server/57306/2 "2016-08-08T15:43:55Z")

</div>

Please have a look at [https://support.google.com/mail/answer/14257](https://support.google.com/mail/answer/14257).

---

<div class="post-metadata">

**Author:** ![r1kumar](https://avatars.discourse-cdn.com/v4/letter/r/aca169/32.png) [@r1kumar](https://discuss.elastic.co/u/r1kumar)\
**Post date:** [August 10, 2016, 4:32am UTC](https://discuss.elastic.co/t/issue-when-sending-email-alert-on-some-particular-event-using-gmail-smtp-server/57306/3 "2016-08-10T04:32:27Z")

</div>

Thanks Magnus.

---

<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, 4:44am UTC](https://discuss.elastic.co/t/issue-when-sending-email-alert-on-some-particular-event-using-gmail-smtp-server/57306/4 "2017-07-06T04:44:11Z")

</div>


