simplejavamail : Batch module not found, make sure it is on the classpath

org.simplejavamail.internal.modules.ModuleLoaderException: Batch module not found, make sure it is on the classpath (https://github.com/bbottema/simple-java-mail/tree/develop/modules/batch-module)

今天使用simplejavamail发送邮件报错,只是把同步改为异步发送,然后就从代码入手看:

public final AsyncResponse sendMail(Email email, boolean async) {
        if (this.validate(email)) {
            SendMailClosure sendMailClosure = new SendMailClosure(this.operationalConfig, this.session, email, this.proxyServer, async, this.operationalConfig.isTransportModeLoggingOnly(), this.smtpConnectionCounter);
            if (!async) {
                sendMailClosure.run();
                return null;
            } else {
            // 如果是异步,这里去加载批处理模块了,但是我本地没有引入批处理模块代码
                return ModuleLoader.loadBatchModule().executeAsync(this.operationalConfig.getExecutorService(), "sendMail process", sendMailClosure);
            }
        } else {
            throw new AssertionError("Email not valid, but no MailException was thrown for it");
        }
    }

加入需要包

<dependency>
    <groupId>org.simplejavamail</groupId>
    <artifactId>simple-java-mail</artifactId>
    <version>6.0.3</version>
</dependency>

<dependency>
    <groupId>org.simplejavamail</groupId>
    <artifactId>batch-module</artifactId>
    <version>6.0.3</version>
</dependency>

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值