title: Spring Java Mail - How to know send mail be read, bounce or forward by receiver?
body: <p>I'm new on spring and java mail, may i know how the email send by java mail is read, bounce or forward. I used google search only found the way how to send a mail. Anyone know where can get the reference on it or provide me some example on it?</p>
  
  <p>Thank you.</p>
  
  <p>Below is my code send mail with spring java mail:</p>
  
  <p><strong>Spring-Mail.xml</strong></p>
  
  <pre><code>&lt;beans xmlns="http://www.springframework.org/schema/beans"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.springframework.org/schema/beans
  http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"&gt;
  
  &lt;bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl"&gt;
      &lt;property name="host" value="smtp.gmail.com" /&gt;
      &lt;property name="port" value="587" /&gt;
      &lt;property name="username" value="xxxxxxxx@gmail.com" /&gt;
      &lt;property name="password" value="xxxxxx" /&gt;
  
      &lt;property name="javaMailProperties"&gt;
         &lt;props&gt;
                &lt;prop key="mail.smtp.auth"&gt;true&lt;/prop&gt;
                &lt;prop key="mail.smtp.starttls.enable"&gt;true&lt;/prop&gt;
                &lt;prop key="mail.smtp.from"&gt;xxxxxxxx@hotmail.com&lt;/prop&gt;
             &lt;/props&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  
  &lt;bean id="mailMail" class="com.penril.my.MailMail"&gt;
      &lt;property name="mailSender" ref="mailSender" /&gt;
  &lt;/bean&gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  <p><strong>MailMail.java</strong></p>
  
  <pre><code>public class MailMail
  {
      private JavaMailSender mailSender;
  
      public void setMailSender(JavaMailSender mailSender) {
          this.mailSender = mailSender;
      }
  
      public void sendMail(String from, String to, String subject, String msg) {
  
          MimeMessage message = mailSender.createMimeMessage();
  
          try {
              MimeMessageHelper helper = new MimeMessageHelper(message, true);
  
              helper.setFrom(from);
              helper.setTo(to);
              helper.setSubject(subject);
              helper.setText(msg);
  
              mailSender.send(message);
  
          } catch (MessagingException e) {
              throw new MailParseException(e);
          }
      }
  }
  </code></pre>
  
  <p><strong>MainClass.java</strong></p>
  
  <pre><code>public class MainClass
  {
      public static void main( String[] args )
      {
          ApplicationContext context = 
               new ClassPathXmlApplicationContext("Spring-Mail.xml");
  
          MailMail mm = (MailMail) context.getBean("mailMail");
          mm.sendMail("xxx123xxx@gmail.com",
                 "xxx234xxx@hotmail.co1m",
                 "Testing123", 
                 "Testing only \n\n Hello Spring Email Sender");
  
      }
  }
  </code></pre>