How to send an email with an attachment?

Discussion in 'Java' started by yihan, Nov 10, 2004.

  1. yihan

    yihan Guest

    Hello,
    I want to send a email with an attachment using Javamail. Can anybody help
    me?
    Thank you.

    zhao
     
    yihan, Nov 10, 2004
    #1
    1. Advertising

  2. yihan

    Chris Smith Guest

    yihan wrote:
    > Hello,
    > I want to send a email with an attachment using Javamail. Can anybody help
    > me?


    Yep. You need to create a MimeMultipart object, and call addBodyPart to
    add both the main message and the attachment, and then use setContent on
    a message to set the MimeMultipart as the content of the message. Then
    send the message as you normally would.

    --
    www.designacourse.com
    The Easiest Way To Train Anyone... Anywhere.

    Chris Smith - Lead Software Developer/Technical Trainer
    MindIQ Corporation
     
    Chris Smith, Nov 10, 2004
    #2
    1. Advertising

  3. yihan

    Andy Flowers Guest

    Andy Flowers, Nov 10, 2004
    #3
  4. yihan wrote:
    > Hello,
    > I want to send a email with an attachment using Javamail. Can anybody help
    > me?


    You can help yourself. The JavaMail package itself comes with a bunch of
    applicable examples. Go to the demo directory of your JavaMail
    installation and study them.

    /Thomas
     
    Thomas Weidenfeller, Nov 10, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sam
    Replies:
    1
    Views:
    428
  2. zhao wang

    How to send the email attachment

    zhao wang, Jan 3, 2005, in forum: Java
    Replies:
    2
    Views:
    441
    Ajith KR via JavaKB.com
    Jan 4, 2005
  3. Andrew Chan
    Replies:
    0
    Views:
    433
    Andrew Chan
    Dec 1, 2004
  4. Andrew Chan
    Replies:
    0
    Views:
    651
    Andrew Chan
    Dec 1, 2004
  5. Christian Otteneuer

    [Zope] how to send email witch attachment in python

    Christian Otteneuer, Oct 8, 2004, in forum: Python
    Replies:
    1
    Views:
    424
    Michele Simionato
    Oct 11, 2004
Loading...

Share This Page