Tagged: JavaMail RSS Toggle Comment Threads | Keyboard Shortcuts

  • dunithd 9:17 am on November 14, 2009 Permalink | Reply
    Tags: JavaMail, proxy   

    Send E-Mail using JavaMail from behind a proxy server 

    If you trying to send an email using JavaMail API from behind a proxy server you would get ‘UnknownHostException’ . Thats because the proxy server doesn’t allow SMTP traffic through it.

    One of my friend Indika Tantrigoda suggested me a forum thread that contains a good solution for this.

    So this is the forum link

    http://forums.sun.com/thread.jspa?threadID=615715

    I think you may find a better answer…

     

     
  • dunithd 8:57 am on November 14, 2009 Permalink | Reply
    Tags: attachement, , JavaMail   

    Send E-mail with attachments using JavaMail 

    As I promised in my earlier post ‘Send E-mail using JavaMail API and your GMail account’ I’ll show you how to send an email with an attachment using JavaMail API (http://java.sun.com/products/javamail).

    Basic steps are similar to my previous post . So before proceed with this one, I recommend you to refer my previous article, in order to get a basic idea.

    If you need to send an email with an attachment, first you need to construct a MimeMultipart message. MimeMultipart message is composed of MimeBodyPart messages. You can attach your file in to MimeBodyPart message and then MimeBodyPart can be further added to MimeMultipart message. Finally MimeMultipart message can be added to basic MimeMessage by calling its setContent (MimeMultipart message) method.

    This relationship is illustrated below.

    Hierarchical view of different messages

    Hierarchical view of different messages

    You can download the complete source code for the application here

     
    • Hesham 5:30 am on October 1, 2011 Permalink | Reply

      Please I want the source code of MimeMessage
      Please send it to me or reactivate the link.
      Thank u in advance.

c
compose new post
j
next post/next comment
k
previous post/previous comment
r
reply
e
edit
o
show/hide comments
t
go to top
l
go to login
h
show/hide help
shift + esc
cancel
Follow

Get every new post delivered to your Inbox.