permaculture playing cards*
The moose likes Other Application Frameworks and the fly likes problem sending mail with spring javamailsender Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "problem sending mail with spring javamailsender" Watch "problem sending mail with spring javamailsender" New topic
Author

problem sending mail with spring javamailsender

Dipika Saxena
Greenhorn

Joined: Mar 27, 2006
Posts: 3
Hi,

I'm unable to send mails using interface org.springframework.mail.javamail.JavaMailSender whereas simple Javamail API is working fine.
I am using following code:
public void sendRegistrationMail(List params)
{
mailSender.send(new MimeMessagePreparator() {
public void prepare(MimeMessage mimeMessage) throws MessagingException {
MimeMessageHelper message = new MimeMessageHelper(mimeMessage, true, "UTF-8");
message.setFrom(new InternetAddress("dsaxena@fiberlink.com"));
message.setTo(new InternetAddress("dipika.saxena@iiitb.ac.in"));
message.setSubject("my subject");
message.setText("my test mail");
//message.addInline("myLogo", new ClassPathResource("img/mylogo.gif"));
//message.addAttachment("myDocument.pdf", new ClassPathResource("doc/myDocument.pdf"));
}
});
}

where mailSender is the bean of type org.springframework.mail.javamail.JavaMailSenderImpl
and I have set the smtp host server as property of this bean in applicationContext-storefront-service.xml as following:

<bean id="mailSender"
class="org.springframework.mail.javamail.JavaMailSenderImpl">
<property name="host">
<value>164.164.104.132</value>
</property>
<property name="port">
<value>25</value>
</property>
</bean>
It is not giving any exception but the mail is not reaching in the inbox whereas if I use JavaMail API, it goes fine.

Please suggest.

Thanks
Dipika
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem sending mail with spring javamailsender
 
Similar Threads
Can we attach multiple email addresses through spring email
How to send an email using spring framework
sending emil with spring mail abstact layer
JavaMail application not making use of all the servers behind the smtp smarthost
Problem at sending email