Spring邮件支持 - 没有主题

Tri*_*ick 3 java email spring

我已经更新了我的库,现在发送的电子邮件没有主题.我不知道这发生在哪里......

Mail API是1.4.3.,Spring 2.5.6.和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>
Run Code Online (Sandbox Code Playgroud)

和属性mail.host,mail.username,mail.password,mail.admin.from,mail.admin.to,mail.admin.cc1.

Java类:

/** 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;
}
Run Code Online (Sandbox Code Playgroud)

以前一切正常,我想知道是否可能与新库有任何冲突.

Tri*_*ick 5

最后 - 我有时间解决这个问题.

在pom.xml中,我添加了java邮件依赖项,并在apache axis transport http依赖项中删除了geronimo javamail的排除.