Porque este código envia email duplicado ?
public static boolean MailSend(String fname, String femail, String tname, String temail, String subject, String msgs) {
try {
if (femail.length() == 0) {
return (false);
}
if (temail.length() == 0) {
return (false);
}
if (fname == null) {
fname = "";
}
if (tname == null) {
tname = "";
}
String from = fname + " <" + femail + ">";
String to = tname + " <" + temail + ">";
Properties props = System.getProperties();
props.put("mail.smtp.host",com.rl.common.Settings.MailServer);
javax.mail.Session msession = javax.mail.Session.getDefaultInstance(props,null);
msession.setDebug(false);
Message msg = new MimeMessage(msession);
msg.setFrom(new InternetAddress(from));
msg.setRecipients(Message.RecipientType.TO,InternetAddress.parse(to,false));
msg.setSubject(subject);
//proudly quick fix
String noHTMLString = msgs.replaceAll("\\<.*?\\>","");
msg.setText(noHTMLString);
msg.setHeader("X-Mailer",com.rl.common.Settings.SiteName + " mail sender");
msg.setSentDate(new java.util.Date());
Transport.send(msg);
return (true);
} catch (Exception ex1) {
Log.write("mailsend.java : " + ex1.getMessage());
return (false);
}
}