dks551
dks551

Reputation: 1113

Does Log4j2 smtp appender works without specifying smtpPassword field?

In the log4j2 offcial documentation there is a code snippet for the smtp appender .My Question here is there is no smtpPassword field included. Is it going to work? if yes then where exactly we are specifying the password.

<Appenders>
    <SMTP name="Mail" 
          subject="Error Log" 
          to="[email protected]" 
          from="[email protected]"
          smtpHost="localhost" 
          smtpPort="25" 
          bufferSize="50">
    </SMTP>
</Appenders>

Upvotes: 2

Views: 593

Answers (1)

Adds
Adds

Reputation: 631

<Appenders>
    <SMTP name="Mailer" 
          suppressExceptions="false"
          subject="${subject}" 
          to="${receipients}" 
          from="${from}"
          smtpHost="${smtpHost}" 
          smtpPort="${smtpPort}"
          smtpProtocol="${smtpProtocol}" 
          smtpUsername="${smtpUser}"
          smtpPassword="${smtpPassword}" 
          smtpDebug="false" 
          bufferSize="20">
        <PatternLayout>
            <pattern>%d{dd-MM-yyyy HH:mm:ss,SSS} %5p %m%n</pattern>
        </PatternLayout>
    </SMTP>
</Appenders>

I think this is what you would be looking for

Upvotes: 1

Related Questions