views:

14

answers:

0

greetings all i am suing spring mail to send emails from localhost using postfix but it's not sending and i got no excpetions maybe there's an error in the configuration, i don't know

1-the method:

public void sendEmailMimeType(final String subject, final String mailTo,
   final String templateName, final Map<String, Object> model) {

  final MimeMessagePreparator preparator = new MimeMessagePreparator() {
   public void prepare(MimeMessage mimeMessage) throws Exception {
    MimeMessageHelper message = new MimeMessageHelper(mimeMessage);

    message.setSubject(subject);
    message.setTo(mailTo);
    message.setFrom(messageSource.getMessage("app.mail.from", null,
      null));

    String text = VelocityEngineUtils.mergeTemplateIntoString(
      velocityEngine, templateName, "UTF-8", model);
    message.setText(text, true);
   }
  };

  new Thread(new Runnable() {
   public void run() {
    mailSender.send(preparator);
   }
  }).start();
 }

2-the properties file:

mail.transport.protocol=smtp
mail.host=localhost
mail.smtp.auth=false
mail.smtp.port=25
mail.smtp.socketFactory.port=25
mail.smtp.socketFactory.class=javax.net.ssl.SSLSocketFactory
mail.smtp.socketFactory.fallback=false
mail.smtp.quitwait=false
mail.smtp.timeout = 25000
[email protected]

3-the xml configuration

<bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
   <property name="host"> <value>${mail.host}</value> </property>
   <property name="port"> <value>${mail.smtp.port}</value> </property>
   <property name="protocol"> <value>${mail.transport.protocol}</value>
   </property> 
  </bean>

any ideas why it's not working