geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jarek Gawor <jga...@gmail.com>
Subject Re: Geronimo Javamail: Email Subject Line Blank
Date Tue, 10 Feb 2009 21:27:52 GMT
Which version of Geronimo JavaMail are you using? Can you try with
latest code: http://people.apache.org/repo/m2-snapshot-repository/org/apache/geronimo/javamail/geronimo-javamail_1.4_mail/1.7-SNAPSHOT/
?

Thanks,
Jarek

On Tue, Feb 10, 2009 at 12:39 PM, DavidCAIT <dzazeski@cait.org> wrote:
>
> I am migrating some code from Sun's JavaMail to Geronimo's JavaMail
> implementation. The code is identical, but I have changed the library
> dependency from Sun JavaMail to Geronimo JavaMail.
>
> However, Geronimo JavaMail now sends out the emails with a blank subject
> line. Does anyone have any ideas about how to set the email subject line
> using geronimo javamail? I have included my code sample below.
>
> Thanks!
>
> import java.util.Date;
> import java.util.Properties;
>
> import javax.mail.Message;
> import javax.mail.MessagingException;
> import javax.mail.Session;
> import javax.mail.Transport;
> import javax.mail.internet.InternetAddress;
> import javax.mail.internet.MimeMessage;
>
>
> public class Mailer {
>
>    public boolean sendMail(String recipient, String message) {
>
>    Properties props = new Properties();
>    props.put("mail.smtp.host", "mailserver.company.com");
>    Session session = Session.getInstance(props);
>
>    try {
>        Message msg = new MimeMessage(session);
>
>        //Set message attributes
>        msg.setFrom(new InternetAddress("support@company.com"));
>        InternetAddress[] address = {new InternetAddress(recipient)};
>        msg.setRecipients(Message.RecipientType.TO, address);
>
>        // setting the subject line!
>        msg.setSubject("Subject Line");
>
>        msg.setSentDate(new Date());
>        msg.setText(message);
>        Transport.send(msg);
>    }
>    catch (MessagingException x) {
>        x.printStackTrace();
>    }
>    return true; }
> }
>
> --
> View this message in context: http://www.nabble.com/Geronimo-Javamail%3A-Email-Subject-Line-Blank-tp21938752s134p21938752.html
> Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.
>
>

Mime
View raw message