I have a problem, i can't find parameters of SMTP Appender in xml format.
<SMTP name="MailAppender"
subject="Great Notes [PROD]"
to="[email protected]"
from="[email protected]"
smtpHost="smtp.gmail.com"
smtpPort="587"
bufferSize="50"
smtpUsername="[email protected]"
smtpPassword="*********"
smtpProtocol="smtps"
mail.smtp.ssl.enable="true"
mail.smtp.starttls.enable="true"
>
<ThresholdFilter level="ERROR" onMatch="ACCEPT" onMismatch="DENY"/>
<PatternLayout>
<Pattern>${LOG_PATTERN}</Pattern>
</PatternLayout>
</SMTP>
So i can't find parameters for: mail.smtp.ssl.enable & mail.smtp.starttls.enable.
I get this error:
ERROR SMTP contains invalid attributes "mail.smtp.ssl.enable", "mail.smtp.ssl.enable"
ERROR SMTP contains invalid attributes "mail.smtp.starttls.enable", "mail.smtp.ssl.enable"
Unrecognized SSL message, plaintext connection? javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 587;
ERROR An exception occurred processing Appender MailAppender org.apache.logging.log4j.LoggingException: Error occurred while sending email
I was able to get it working with the following appender configuration and sending some ERROR level messages in a test:
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
<SMTP name="SmtpAppender"
to="[email protected]"
from="[email protected]"
smtpHost="smtp.gmail.com"
smtpPort="465"
bufferSize="4"
smtpUsername="[email protected]"
smtpPassword="myPassword"
smtpProtocol="smtps"
smtpDebug="true"
ignoreExceptions="false"
subject="Test">
</Appenders>
<Loggers>
<Root level="ERROR">
<AppenderRef ref="SmtpAppender"/>
</Root>
</Loggers>
</Configuration>
However, you'll have to turn off the simple auth setting on the Gmail account doing the sending. Otherwise, it will block the login/send.
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加