M
mrby
Hi, guys:
A problem about JavaMail, how could I resend
a message using a different SMTP server?
This is the my code snippet:
....
Properties props = new Properties();
debug.op("email.send: host=" + host );
props.put("mail.smtp.host", host );
Session session = Session.getDefaultInstance(props, null);
try {
// create a message
Message msg = new MimeMessage(session);
msg.setFrom(new InternetAddress(from));
msg.setRecipients( Message.RecipientType.TO,
InternetAddress.parse(total_to_list) );
msg.setSubject(subject);
msg.setText(total_message);
Transport.send(msg);
}
catch (MessagingException mex) {
// If exception occurs here, I want to change the SMTP
// server and resend the message. How could I do?
// Is there a nice way besides retyping those code?
}
Thanks much!
A problem about JavaMail, how could I resend
a message using a different SMTP server?
This is the my code snippet:
....
Properties props = new Properties();
debug.op("email.send: host=" + host );
props.put("mail.smtp.host", host );
Session session = Session.getDefaultInstance(props, null);
try {
// create a message
Message msg = new MimeMessage(session);
msg.setFrom(new InternetAddress(from));
msg.setRecipients( Message.RecipientType.TO,
InternetAddress.parse(total_to_list) );
msg.setSubject(subject);
msg.setText(total_message);
Transport.send(msg);
}
catch (MessagingException mex) {
// If exception occurs here, I want to change the SMTP
// server and resend the message. How could I do?
// Is there a nice way besides retyping those code?
}
Thanks much!