修改配置文件
| [root@node1 conf] |
| /opt/app/azkaban-3.85.0/web-server/conf |
| |
| [root@node1 conf] |
| azkaban.properties azkaban-users.xml global.properties log4j.properties |
| |
| [root@node1 conf] |
| { |
| mail.sender=1941323335@qq.com |
| mail.host=smtp.qq.com |
| mail.user=1941323335@qq.com |
| mail.password=QHFORNQJMAGBCISU |
| } |
| 或者 |
| { |
| mail.sender=jsq951357@163.com |
| mail.host=smtp.163.com |
| mail.user=jsq951357@163.com |
| mail.password=QHFORNQJMAGBCISU |
| } |

java代码
- pom.xml文件

- java代码
| import javax.mail.*; |
| import javax.mail.internet.InternetAddress; |
| import javax.mail.internet.MimeMessage; |
| import javax.mail.internet.MimeUtility; |
| import java.io.UnsupportedEncodingException; |
| import java.util.Properties; |
| |
| public class Test { |
| public static String emailHost = "smtp.qq.com"; |
| public static String transportType = "smtp"; |
| public static String fromUser = "支鹏"; |
| public static String fromEmail = "xxxx@qq.com"; |
| public static String authCode = "xxxxx"; |
| |
| public static void main(String[] args) throws UnsupportedEncodingException, javax.mail.MessagingException { |
| |
| |
| Properties props = new Properties(); |
| props.setProperty("mail.transport.protocol", transportType); |
| props.setProperty("mail.host", emailHost); |
| props.setProperty("mail.user", fromUser); |
| props.setProperty("mail.from", fromEmail); |
| props.setProperty("mail.smtp.auth", "true"); |
| Authenticator auth = new Authenticator() { |
| public PasswordAuthentication getPasswordAuthentication() { |
| return new PasswordAuthentication(fromEmail, authCode); |
| } |
| }; |
| |
| Session session = Session.getInstance(props, auth); |
| |
| session.setDebug(true); |
| |
| |
| MimeMessage message = new MimeMessage(session); |
| |
| |
| |
| |
| |
| String formName = MimeUtility.encodeWord("支鹏") + " <" + fromEmail + ">"; |
| InternetAddress from = new InternetAddress(formName); |
| message.setFrom(from); |
| |
| |
| InternetAddress to = new InternetAddress("1101810845@qq.com"); |
| message.setRecipient(Message.RecipientType.TO, to); |
| |
| |
| message.setSubject("测试"); |
| |
| |
| message.setContent("<h1>测试标题</h1><button>登录</button>", "text/html;charset=UTF-8"); |
| |
| |
| message.saveChanges(); |
| |
| |
| Transport transport = session.getTransport(); |
| |
| transport.send(message); |
| } |
| } |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· 三行代码完成国际化适配,妙~啊~
· .NET Core 中如何实现缓存的预热?