Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2005
    Posts
    18

    Red face Unanswered: Urgent Question on SMTPMessage

    Hi,

    Can someone tell me how to send a "HTML formatted" email using com.sun.mail.smtp.SMTPMessage?

    There is a setText() method in SMTPMessage class which defaults to the content-type of "plain/text". I want to know whether we can send out emails in HTML format using SMTPMessage class. If so how? Is there a way to set the content-type to HTML?

    I need this info very urgently. I would appreciate if anyone can send a quick response to me.

    Thanks a million,
    regards,
    sbk

  2. #2
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    You'll need to use setContent(), not setText().

  3. #3
    Join Date
    Jan 2005
    Posts
    18
    Thanks for the reply n_i, you are right, but which class in the javax.mail API provides this method. I could not find any class either in javax.mail or javax.mail.internet that has a facility to set the content.

    The setText() method which is used to set the text of the message defaults to plain/text.

    Thanks,
    sbk

  4. #4
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    Man, you need to learn how to use google...

    http://java.sun.com/products/javamail/javadocs/javax/mail/internet/MimeMessage.html#setContent(java.lang.Object,%20ja va.lang.String)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •