3
回答
Java send email using thread
for(SObject contact : contacts) {
	Thread thread = new Thread(new SendMessageRunnable(transport, msg, sender, emailTemplate, contact, attachments, documents));
	thread.start();
	listThread.add(thread);
}
之前是在transport.connect("email-smtp.us-east-1.amazonaws.com", emailUser, emailPassword); 停止的,后来我把这句加到了循环外。现在执行到transport.sendMessage(msg, msg.getAllRecipients()); 就停止了。单线程是没有问题的。

Thanks a lot.
举报
samba
发帖于6年前 3回/369阅
顶部