I am trying to send error email through log4j. by using following appender:
<appender name="ERROR_MAIL" class="org.apache.log4j.net.SMTPAppender">
<param name="SMTPUsername" value="[email protected]" />
<param name="SMTPPassword" value="**********" />
<param name="To" value="[email protected]"/>
<param name="From" value="[email protected]"/>
<param name="Subject" value="Newyse Error "/>
<param name="SMTPHost" value="smtp.gmail.com"/>
<param name="SMTPPort" value="25" />
<param name="BufferSize" value="10"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="[%d{ISO8601} %t %5p %c:$L]"/>
</layout>
<filter class="org.apache.log4j.varia.LevelRangeFilter">
<param name="LevelMin" value="ERROR"/>
<param name="LevelMax" value="FATAL"/>
</filter>
</appender>
but I am getting the following exception
com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.0 Must issue a STARTTLS command first. wr9sm43519864pbc.7 - gsmtp
from several other question I understood that I need to add the following property in the smtpAppender
props.put("mail.smtp.starttls.enable", "true");
So how we can add it to the existing SMTPAppender ?