PDA

View Full Version : Spring and Javamail


CuriousHARD
Jun 15th, 2007, 07:06 AM
hi i want to send an email programatically in my spring application,...

my configuration entries are

<bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderIm pl">
<property name="host" value="auth.smtp.1and1.co.uk"/> <!-- auth.smtp.1and1.co.uk -->
<property name="port" value="25" />
<property name="protocol" value="smtp" />
<property name="username" value="atieq@aedsys.co.uk"/>
<property name="password" value="university"/>
<property name="javaMailProperties">
<props>
<prop key="mail.smtps.auth">true</prop>
</props>
</property>
</bean>

<bean id="mailMessage" class="org.springframework.mail.SimpleMailMessage">
<property name="from">
<value>atieq@aedsys.co.uk</value>
</property>
<property name="subject">
<value>File finished uploading</value>
</property>
</bean>


and the code is

SimpleMailMessage msg = new SimpleMailMessage(this.msg);
msg.setTo("curious_hard@hotmail.com");
msg.setText("This is the testing mail ");

mailSender.send(msg);


i m receiving an error

org.springframework.mail.MailSendException; nested exception details (1) are:
Failed message 1:
javax.mail.SendFailedException: Invalid Addresses;
nested exception is:
com.sun.mail.smtp.SMTPAddressFailedException: 550 must be authenticated




i could nt understand what is the problem ....

eager to get reply

dr_pompeii
Jun 15th, 2007, 07:53 AM
hi man

maybe this link can be useful, i had the same party of problems(and others) with the mail topic, maybe my configuration can help
HTH
http://forum.springframework.org/showthread.php?t=33667

regards

karldmoore
Jun 15th, 2007, 08:10 AM
I'd also try searching for the exception on the net, I'm sure it's a common one.

viraj
Jun 19th, 2007, 11:42 PM
Hi,

I met this error long time ago. The problem lies not in the code, but in the mail server configuration. Please check your mail server configuration.
You can check whether the mail server allows you to send mails through a program. (Write a simple program and check it. This will help you to figure out where the problem is.)

/Viraj