title: SMTP connection test
body: <p>I've been working on a prj(using JAVA SMTPAPI) in which I have to write a program for connectivity with SMTP. I have written a program using help of Google. now plz what I have to do? I have no IDEA further.
  any advice or help would be appritiated
  I have got this code</p>
  
  <pre><code>package mypackage;
  
  import javax.mail.*;
  import java.util.*;
  import javax.mail.internet.*;
  
  
  public class Sendmail {
  
      private String strstmp;
  
      public String getStrstmp() {
          return strstmp;
      }
  
  
      public void setStrstmp(String strstmp) {
          this.strstmp = strstmp;
      }
  
      public void sendMail( String recipients[ ], String subject, String message , String from)
      {
          // TODO Auto-generated method stub
          boolean debug = false;
  
          //set the host smtp addrs 
          Properties props = new Properties();
          props.put("mail.smtp.host",getStrstmp());
  
          //get default session
          Session session = Session.getDefaultInstance(props, null);
          session.setDebug(debug);
  
          //create a new message 
          Message msg = new MimeMessage(session);
  
  
          //set the from and to addrs
          InternetAddress addressFrom = new InternetAddress(from);
          msg.setFrom(addressFrom);
          InternetAddress[] addressto = new InternetAdrress[recipients.length];
  
          for(i = 0;i&lt;recipients.length;i++)
          {
  
                  addressTo[i] = new InternetAddress(recipients[i]);
  
          }
          msg.setRecipients(Message.RecipientType.TO, addressTo);
  
          // Setting the Subject and Content Type
          msg.setSubject(subject);
          msg.setContent(message, "text/plain");
  
          //send message
          Transport.send(msg);
  
      }
  
  
  
  
  }
  
  now wat would be addrs of host? 
  how to do connectivity test ?
  
  Thanks in advance
  </code></pre>