且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

运行Groovy脚本-发送电子邮件

更新时间:2023-12-05 14:39:28

javax.mail 类不是JDK的一部分,因此您需要显式包括它们。在Groovy脚本中,最简单的方法是使用 @Grab ,例如

The javax.mail classes are not part of the JDK, so you need to explicitly include them. In a Groovy script, the easiest way to do this is with @Grab, e.g.

@Grab(group='javax.mail', module='mail', version='1.4.7')
import javax.mail.*
import javax.mail.internet.*

// the rest of your script goes here