电子邮件问题,发送一些字符串但不发送其他字符串

时间:2014-10-30 05:57:27

标签: java javamail

我创建了以下代码:

for (i=0;i<count;i++) {
    substM=LinesList.get(index[i]).split("[|]"); 
    ///*********Email settings************////
    final String username = "it-support@test.com";
    final String password = "IamSoHappy";

    Properties props = new Properties();
    props.put("mail.smtp.starttls.enable", "true");
    props.put("mail.smtp.auth", "true");
    props.put("mail.smtp.host", "mail.test.com");
    props.put("mail.smtp.port", "25");

    Session session = Session.getInstance(props,
          new javax.mail.Authenticator() {
              protected PasswordAuthentication getPasswordAuthentication() {
                    return new PasswordAuthentication(username, password);
          }
    });
    Message message = new MimeMessage(session);
    message.setFrom(new InternetAddress("it-support@test.com"));
    message.setRecipients(Message.RecipientType.TO,
    InternetAddress.parse("Alen@test.com"));
    message.setSubject(substM[10]+" is left open by "+ substM[11]);

    ///*******To get Date and Time******/////
    String st=substM[13];
    Date date = new SimpleDateFormat("yyMMddHHmmss",Locale.getDefault()).parse(st);
    ///******************************//////
    String st1= substM[10],st2=substM[11];
    message.setText("Dear IT Support Team,"
               + "\n\n"+st1+" is left opened by '"+ st2+"' since "+date +" .. !!"
               + "\n\n"+"Regards," + "\nIT Support Team");
    Transport.send(message);
}

如果index[i]包含字符串列表中包含我要查看的行的索引,并且这些行包含以下信息:

002|0000|00|00002392651|41933.3385069444|00032018|M|        |1|2|OFFICE 2|guest03 guest03|0|141021080727| 
002|0000|00|00002392651|41932.3409953704|00032018|M|        |1|2|OFFICE 2|Lubna|0|141020081102|
002|0000|00|00002392651|41933.3385069444|00032018|M|        |1|2|OFFICE 2|guest03 guest03|0|141021080100|

我能够打印所有lineslist.get(index[i])及其输出,与上面的行相同,我也可以接收第一行和最后一行,但不是中间行?

为什么??? ???

0 个答案:

没有答案