Sending Mail using MailSender
<p>I am using SimpleMailMessage and MailSender in Spring to send mail. I have configured .xml file as  </p>

<pre><code>&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="465" /&gt;
        &lt;property name="protocol" value="smtps"&gt;&lt;/property&gt;
        &lt;property name="username" value="userId@gmail.com" /&gt;
        &lt;property name="password" value="passward" /&gt;
        &lt;property name="endoding" value="UTF-8"&gt;&lt;/property&gt;
        &lt;property name="javaMailProperties"&gt;
        &lt;props&gt;
            &lt;prop key="mail.smtp.starttls.enable"&gt;true&lt;/prop&gt;
            &lt;prop key="mail.smtps.auth"&gt;true&lt;/prop&gt;
        &lt;/props&gt;
        &lt;/property&gt;

&lt;bean id="userRegistrationService" class="UserRegistrationService"&gt;
        &lt;property name="mailSender" ref="mailSender" /&gt;
        &lt;property name="userEmailIds"&gt;
        &lt;set&gt;
            &lt;value&gt;abc@gmail.com&lt;/value&gt;
            &lt;value&gt;abc@yahoo.co.in&lt;/value&gt;
        &lt;/set&gt;
        &lt;/property&gt;         
    &lt;/bean&gt;     
    &lt;/bean&gt; 
</code></pre>

<p>but I get error : </p>

<pre><code>Failed messages: com.sun.mail.smtp.SMTPSendFailedException: 530-5.5.1 Authentication Required. 
Learn more at                              
    530 5.5.1 http://mail.google.com/support/bin/answer.py?answer=14257 i7sm235670pbj.90
</code></pre>

<p>What could be the reason?</p>
