Envio de email duplicado

3 respostas
U

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 + " &lt" + femail + "&gt";
			String to = tname + " &lt" + temail + "&gt";

			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("\\&lt.*?\\&gt","");

			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);
		}

	}

3 Respostas

U

alguém ja viu isso ? porque este código manda email duplicado ?

T

Se você pegar esse código (InternetAddress.parse(to,false)) ele volta um array de quantas posições?

U

retorna 1

Criado 27 de março de 2007
Ultima resposta 27 de mar. de 2007
Respostas 3
Participantes 2