Spring mail support - no subject

Posted by Trick on Stack Overflow See other posts from Stack Overflow or by Trick
Published on 2010-02-22T12:13:17Z Indexed on 2010/04/06 8:23 UTC
Read the original article Hit count: 944

Filed under:
|
|
|
|

I have updated my libraries, and now e-mails are sent without subject. I don't know where this happened...

Mail API is 1.4.3., Spring 2.5.6. and Spring Integration Mail 1.0.3.RELEASE.

<!-- Definitions for SMTP server -->
<bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
    <property name="host" value="${mail.host}" />
    <property name="username" value="${mail.username}" />
    <property name="password" value="${mail.password}" />
</bean>

<bean id="adminMailTemplate" class="org.springframework.mail.SimpleMailMessage" >
    <property name="from" value="${mail.admin.from}" />
    <property name="to" value="${mail.admin.to}" />
    <property name="cc">
        <list>
            <value>${mail.admin.cc1}</value>
        </list>
    </property>
</bean>

<!-- Mail service definition -->
<bean id="mailService" class="net.bbb.core.service.impl.MailServiceImpl">
    <property name="sender" ref="mailSender"/>
    <property name="mail" ref="adminMailTemplate"/>
</bean>

And properties mail.host,mail.username,mail.password,mail.admin.from,mail.admin.to, mail.admin.cc1.

Java class:

/** The sender. */
private MailSender sender;

/** The mail. */
private SimpleMailMessage mail;

public void sendMail() {
    this.mail.setSubject("Subject");

    this.mail.setText("msg body");          

    try {
        getSender().send(this.mail);
    } catch (MailException e) {
        log.error("Error sending mail!",e);
    }
}

public SimpleMailMessage getMail() {
    return this.mail;
}

public void setMail(SimpleMailMessage mail) {
    this.mail = mail;
}

public MailSender getSender() {
    return this.sender;
}

public void setSender(MailSender mailSender1) {
    this.sender = mailSender1;
}

Everything worked before, I am wondering if there may be any conflicts with new libraries.

© Stack Overflow or respective owner

Related posts about java

Related posts about mail