title: Send mail from outlook 2010 using java mail api
body: <p>Hi i am trying to send an email from outlook 2010 with the help of below code.</p>
  
  <pre><code>package javamail;
  
  import java.util.Properties;
  
  import javax.mail.Message;
  import javax.mail.MessagingException;
  import javax.mail.PasswordAuthentication;
  import javax.mail.Session;
  import javax.mail.Transport;
  import javax.mail.internet.InternetAddress;
  import javax.mail.internet.MimeMessage;
  
  public class JavaMailTest {
      public static void main(String[] args) {
          String host="host";  
          final String user="username@domain.com";//change accordingly  
          String to="username@domain.com";//change accordingly  
  
          //Get the session object  
          Properties props = new Properties();  
          props.put("mail.smtp.host",host);  
          props.put("mail.smtp.auth", "false");
  
          Session session=Session.getDefaultInstance(props, null);
          session.setDebug(true);
  
          //Compose the message  
          try {
              MimeMessage message = new MimeMessage(session);
              message.saveChanges();
              message.setFrom(new InternetAddress(user));  
              message.addRecipient(Message.RecipientType.TO,new InternetAddress(to));  
              message.setSubject("Test mail");  
              message.setText("This is test mail.");  
  
              //send the message
              Transport.send(message);
  
              System.out.println("message sent successfully...");
          }
          catch (MessagingException e) {e.printStackTrace();}
  
      }
  }
  </code></pre>
  
  <p>The above code works properly and i am able to send the mail(after my tech admin enabled relaying on server). But the problem is i am not able to see the sent mail in my outlook. On analysis i found out that java mail api sends the mail directly from the smtp server. But i want the mail to send from my outlook profile i.e i should be able to see it in my sent mail folder. How should i do it? What api or 3rd party open source library can be used to achieve this?</p>