No Exception In Apache James Server <p>I am using Apache James Server to send e-mails on my localhost. When an e-mail is not sent, no Exception is thrown through from the Java Spring code. I am using Apache James Server 3. Below is my code. Usually, when you have an online server an Exception is thrown. Do I need to configure something in Apache James Server? E-mails are sent to local users but I want to send to an external e-mail address. I know the e-mail won't be sent, but no Exception is thrown. However, the Apache James Server keeps on trying to resend the e-mail. Any ideas?</p> <p>Below is my code:</p> <pre><code>public class Email extends Message { private JavaMailSender javaMailSender; public Email() { } public JavaMailSender getJavaMailSender() { return javaMailSender; } public void setJavaMailSender(JavaMailSender javaMailSender) { this.javaMailSender = javaMailSender; } public boolean sendEmailMessage(String from, String to, String body, String subject) throws Exception { boolean isEmailSent = false; try { javaMailSender.send(new MessageBuilder(from, to , body, subject)); isEmailSent = true; } catch(Exception e) { System.out.println("Exception : " + " " + e.getMessage()); } } return isEmailSent; } } package com.JavaMailWithSpring; import org.springframework.mail.javamail.MimeMessageHelper; import org.springframework.mail.javamail.MimeMessagePreparator; import javax.mail.internet.MimeMessage; public class MessageBuilder implements MimeMessagePreparator { private String from; private String to; private String body; private String subject; public MessageBuilder(String from, String to, String subject, String body) { this.from = from; this.to = to; this.subject = subject; this.body = body; } public void prepare(MimeMessage msg) throws Exception { MimeMessageHelper helper = new MimeMessageHelper(msg, true); helper.setFrom(from); helper.setTo(to); helper.setSubject(subject); helper.setText(body); } } </code></pre> <p>beans.xml</p> <pre><code>&lt;bean id="mailSenderBean" class="org.springframework.mail.javamail.JavaMailSenderImpl"&gt; &lt;property name="host" value="localhost"&gt;&lt;/property&gt; &lt;property name="javaMailProperties"&gt; &lt;props&gt; &lt;prop key="mail.smtp.port"&gt;25&lt;/prop&gt; &lt;/props&gt; &lt;/property&gt; &lt;/bean&gt; </code></pre>