Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

i want to send emails to an address with a java program (using javamail) via smtp. it actually send the emails to the destination. the problem is the body of the email isn't send fully each time. considering that the body of my mail is extracted from a database. here's my code:

public static void smail(Connection con, String state)
            Statement stmt;

                stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);

                ResultSet res = stmt.executeQuery("select ID, Time_C from production where State='"+state+"'");

                    String id=res.getString("1"), tc=res.getString("2"); 
                    testmail smtpMailSend = new testmail();
                    String sub="Alert "+state;
                        String mes=" ID "+id +"\n Stat: "+state +"\n time: "+tc;
             } catch(Exception e)
                stmt = null;
    public void sMail(String obj,String text)throws MessagingException
    Properties props = new Properties();
        props.put("", d_host);
        props.put("mail.smtp.port", d_port);
        props.put("mail.smtp.debug", "true");
        props.put("mail.smtp.auth", "true");
        Authenticator auth = new SMTPAuthenticator();
        Session session = Session.getInstance(props, auth);
        Message msg = new MimeMessage(session);
        msg.setFrom(new InternetAddress(d_email));
        msg.addRecipient(Message.RecipientType.TO, new InternetAddress(m_to));
        Transport transport = session.getTransport("smtps");
        transport.connect(d_host, d_port, d_uname, d_password);
        transport.sendMessage(msg, msg.getAllRecipients());

so after 2 first record, i've in the mail "ID: 12345" without the time or the state.

thanks for your help

share|improve this question

Can you verify that the body of the message is intact each and every time as it leaves the sending server on your side? If so, something on the recipient side may be stripping out the content.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.