0

我已经为 smtp appender 配置了以下属性。相同的配置在本地运行良好,但在 AWS 上出现错误

log4j.appender.email=org.apache.log4j.net.SMTPAppender
log4j.appender.email.BufferSize=20
log4j.appender.email.SMTPHost=email-smtp.us-east-1.amazonaws.com
log4j.appender.email.SMTPUsername=<username>
log4j.appender.email.SMTPPassword=<password>
log4j.appender.email.SMTPPort=587
log4j.appender.email.From=<from@email>
log4j.appender.email.To=<to@email>
log4j.appender.email.Subject=<Subjec>
log4j.appender.email.layout=org.apache.log4j.PatternLayout
log4j.appender.email.layout.ConversionPattern=%d %-5p [%t] (%c{1}:%L) - %m%n
log4j.appender.email.SMTPDebug=true
log4j.appender.email.EnableSsl=true
log4j.appender.email.smtp.starttls.enable=true
log4j.appender.email.smtp.auth=true
log4j.appender.email.TLS=true
4

2 回答 2

1

代替

    <dependency>
        <groupId>javax.mail</groupId>
        <artifactId>javax.mail-api</artifactId>
        <version>1.6.2</version>
    </dependency>

<dependency>
   <groupId>com.sun.mail</groupId>
    <artifactId>jakarta.mail</artifactId>
    <version>1.6.7</version>
</dependency>
于 2021-11-17T13:53:03.577 回答
0

解决方案:我使用 1.6.4 版本的 mailapi 和 smtp jars。

于 2021-08-09T09:11:41.967 回答