KickJava   Java API By Example, From Geeks To Geeks.

Java > Java SE, EE, ME > javax > mail > internet > MimeMessage

javax.mail.internet
Class MimeMessage

java.lang.Object
  extended byjavax.mail.Message
      extended byjavax.mail.internet.MimeMessage
All Implemented Interfaces:
MimePart, Part
See Also:
Top Examples, Source Code

public void addFrom(Address[] addresses)
             throws MessagingException
See Also:
IllegalStateException, IllegalWriteException, Message
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void addHeader(String name,
                      String value)
               throws MessagingException
See Also:
MimeUtility, IllegalStateException, IllegalWriteException, Part
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[633]Specify version for MIME message
By vaughnwoz { at } yahoo { dot } com on 2004/01/30 13:53:03  Rate
MimeMessage.addHeader (  "MIME-Version", "1.0"  ) ;

public void addHeaderLine(String line)
                   throws MessagingException
See Also:
IllegalStateException, IllegalWriteException, MimePart
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void addRecipients(Message.RecipientType type,
                          String addresses)
                   throws MessagingException
See Also:
IllegalStateException, IllegalWriteException, AddressException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void addRecipients(Message.RecipientType type,
                          Address[] addresses)
                   throws MessagingException
See Also:
IllegalStateException, IllegalWriteException, Message
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


protected byte[] content
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


protected InputStream contentStream
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


protected InternetHeaders createInternetHeaders(InputStream is)
                                         throws MessagingException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


protected DataHandler dh
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


protected Flags flags
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public Enumeration getAllHeaderLines()
                              throws MessagingException
See Also:
MimePart
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public Enumeration getAllHeaders()
                          throws MessagingException
See Also:
MimeUtility, Part
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public Address[] getAllRecipients()
                           throws MessagingException
See Also:
MimeMessage.RecipientType.NEWSGROUPS, Message.RecipientType.BCC, Message.RecipientType.CC, Message.RecipientType.TO, Message
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public Object getContent()
                  throws IOException,
                         MessagingException
See Also:
Part
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public String getContentID()
                    throws MessagingException
See Also:
MimePart
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public String[] getContentLanguage()
                            throws MessagingException
See Also:
MimePart
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public String getContentMD5()
                     throws MessagingException
See Also:
MimePart
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


protected InputStream getContentStream()
                                throws MessagingException
See Also:
content
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public String getContentType()
                      throws MessagingException
See Also:
DataHandler, Part
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public DataHandler getDataHandler()
                           throws MessagingException
See Also:
Part
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public String getDescription()
                      throws MessagingException
See Also:
Part
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public String getDisposition()
                      throws MessagingException
See Also:
Part.getFileName(), Part.INLINE, Part.ATTACHMENT
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public String getEncoding()
                   throws MessagingException
See Also:
MimePart
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public String getFileName()
                   throws MessagingException
See Also:
Part
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public Flags getFlags()
               throws MessagingException
See Also:
Message
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public Address[] getFrom()
                  throws MessagingException
See Also:
headers, Message
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public String[] getHeader(String name)
                   throws MessagingException
See Also:
MimeUtility, Part
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public String getHeader(String name,
                        String delimiter)
                 throws MessagingException
See Also:
MimePart
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public InputStream getInputStream()
                           throws IOException,
                                  MessagingException
See Also:
getContentStream(), Part
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public int getLineCount()
                 throws MessagingException
See Also:
Part
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public Enumeration getMatchingHeaderLines(String[] names)
                                   throws MessagingException
See Also:
MimePart
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public Enumeration getMatchingHeaders(String[] names)
                               throws MessagingException
See Also:
Part
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public String getMessageID()
                    throws MessagingException
See Also:
MessageIDTerm
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public Enumeration getNonMatchingHeaderLines(String[] names)
                                      throws MessagingException
See Also:
MimePart
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public Enumeration getNonMatchingHeaders(String[] names)
                                  throws MessagingException
See Also:
Part
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public InputStream getRawInputStream()
                              throws MessagingException
See Also:
getContentStream(), getInputStream()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public Date getReceivedDate()
                     throws MessagingException
See Also:
Message
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public Address[] getRecipients(Message.RecipientType type)
                        throws MessagingException
See Also:
MimeMessage.RecipientType.NEWSGROUPS, Message.RecipientType.BCC, Message.RecipientType.CC, Message.RecipientType.TO, headers, AddressException, Message
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public Address[] getReplyTo()
                     throws MessagingException
See Also:
headers, Message
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public Address getSender()
                  throws MessagingException
See Also:
headers
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public Date getSentDate()
                 throws MessagingException
See Also:
Message
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public int getSize()
            throws MessagingException
See Also:
Part
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public String getSubject()
                  throws MessagingException
See Also:
headers, Message
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


protected InternetHeaders headers
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public boolean isMimeType(String mimeType)
                   throws MessagingException
See Also:
Part
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public boolean isSet(Flags.Flag flag)
              throws MessagingException
See Also:
Flags.Flag.SEEN, Flags.Flag.RECENT, Flags.Flag.FLAGGED, Flags.Flag.DRAFT, Flags.Flag.DELETED, Flags.Flag.ANSWERED, Message
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


protected MimeMessage(Folder folder,
                      int msgnum)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


protected MimeMessage(Folder folder,
                      InputStream is,
                      int msgnum)
               throws MessagingException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


protected MimeMessage(Folder folder,
                      InternetHeaders headers,
                      byte[] content,
                      int msgnum)
               throws MessagingException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public MimeMessage(MimeMessage source)
            throws MessagingException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public MimeMessage(Session session)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[688]Mail it
By armainak { dot } sarkis { at } itcc { dot } datos { dot } de on 2004/03/08 08:03:56  Rate
public String mailIt  
     ( java.lang.String from,  
    java.lang.String to,  
    java.lang.String subject,  
    java.lang.String textmessage )   
  {   
    String status = "Your message was sent";  
    try  {   
  
  
    //Obtain the initial JNDI context  
    InitialContext ctx = new InitialContext (  ) ;  
  
  
    //Perform a JNDI lookup to obtain the resource  
    //reference object  
    Session session =  ( Session )  ctx.lookup ( "java:comp/env/mail/mymailserver" ) ;  
  
  
    //Construct the message  
    MimeMessage message = new MimeMessage ( session ) ;  
  
  
    //Set the from address  
    Address [  ]  fromAddress = InternetAddress.parse ( from ) ;  
    message.addFrom ( fromAddress ) ;  
  
  
    //Set the to address  
    Address [  ]  toAddress = InternetAddress.parse ( to ) ;  
    message.setRecipients ( Message.RecipientType.TO,toAddress ) ;  
  
  
    //Set the subject and text  
    message.setSubject ( subject ) ;  
    message.setText ( textmessage ) ;  
  
  
    //Send the message  
    Transport.send ( message ) ;  
  
  
     }  catch ( AddressException e )   {   
      status = "There was an error parsing the addresses"+e;  
     }  catch ( SendFailedException e )   {   
      status = "There was an error sending the message"+e;  
     }  catch  ( MessagingException e )   {   
      status = "There was an unexpected error"+e;  
     }  catch  ( NamingException e )   {   
      status = "The mail session could not be created.";  
     }   
  
  
   System.out.println ( "The status is:"+ status ) ;  
   return status;  
  }  


public MimeMessage(Session session,
                   InputStream is)
            throws MessagingException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


protected boolean modified
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


protected void parse(InputStream is)
              throws MessagingException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void removeHeader(String name)
                  throws MessagingException
See Also:
IllegalStateException, IllegalWriteException, Part
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public Message reply(boolean replyToAll)
              throws MessagingException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void saveChanges()
                 throws MessagingException
See Also:
IllegalStateException, IllegalWriteException, Message
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


protected boolean saved
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void setContent(Object o,
                       String type)
                throws MessagingException
See Also:
IllegalStateException, IllegalWriteException, Part
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[165]Specify content type for MIME message
By Anonymous on 2004/03/23 11:23:19  Rate
setContent ( html,"text/html" ) 

public void setContent(Multipart mp)
                throws MessagingException
See Also:
IllegalStateException, IllegalWriteException, Part
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void setContentID(String cid)
                  throws MessagingException
See Also:
IllegalStateException, IllegalWriteException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void setContentLanguage(String[] languages)
                        throws MessagingException
See Also:
IllegalStateException, IllegalWriteException, MimePart
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void setContentMD5(String md5)
                   throws MessagingException
See Also:
IllegalStateException, IllegalWriteException, MimePart
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void setDataHandler(DataHandler dh)
                    throws MessagingException
See Also:
IllegalStateException, IllegalWriteException, Part
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void setDescription(String description)
                    throws MessagingException
See Also:
IllegalStateException, IllegalWriteException, Part
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void setDescription(String description,
                           String charset)
                    throws MessagingException
See Also:
IllegalStateException, IllegalWriteException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void setDisposition(String disposition)
                    throws MessagingException
See Also:
Part.setFileName(java.lang.String), Part.INLINE, Part.ATTACHMENT, IllegalStateException, IllegalWriteException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void setFileName(String filename)
                 throws MessagingException
See Also:
IllegalStateException, IllegalWriteException, Part
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void setFlags(Flags flag,
                     boolean set)
              throws MessagingException
See Also:
MessageChangedEvent, IllegalStateException, IllegalWriteException, Message
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void setFrom()
             throws MessagingException
See Also:
IllegalStateException, IllegalWriteException, Message
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void setFrom(Address address)
             throws MessagingException
See Also:
IllegalStateException, IllegalWriteException, Message
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void setHeader(String name,
                      String value)
               throws MessagingException
See Also:
MimeUtility, IllegalStateException, IllegalWriteException, Part
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void setRecipients(Message.RecipientType type,
                          String addresses)
                   throws MessagingException
See Also:
getRecipients(javax.mail.Message.RecipientType), IllegalStateException, IllegalWriteException, AddressException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void setRecipients(Message.RecipientType type,
                          Address[] addresses)
                   throws MessagingException
See Also:
getRecipients(javax.mail.Message.RecipientType), IllegalStateException, IllegalWriteException, Message
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void setReplyTo(Address[] addresses)
                throws MessagingException
See Also:
IllegalStateException, IllegalWriteException, Message
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void setSender(Address address)
               throws MessagingException
See Also:
IllegalStateException, IllegalWriteException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void setSentDate(Date d)
                 throws MessagingException
See Also:
IllegalStateException, IllegalWriteException, Message
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void setSubject(String subject)
                throws MessagingException
See Also:
IllegalStateException, IllegalWriteException, Message
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void setSubject(String subject,
                       String charset)
                throws MessagingException
See Also:
IllegalStateException, IllegalWriteException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void setText(String text)
             throws MessagingException
See Also:
setText(String text, String charset), MimePart
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void setText(String text,
                    String charset)
             throws MessagingException
See Also:
MimePart
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


protected void updateHeaders()
                      throws MessagingException
See Also:
IllegalStateException, IllegalWriteException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[1951]
By acridity on 2008/01/28 04:56:05  Rate
To get rid of JavaMail "X-Message-Id"  ( JavaMail@SQL ) ,  
  
  
 it's better to override: 
  
  
 protected void updateHeaders (  )  
         throws MessagingException 
      {  
         setHeader ( "Mime-Version", "1.0" ) ; 
      } 


public void writeTo(OutputStream os)
             throws IOException,
                    MessagingException
See Also:
Part
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void writeTo(OutputStream os,
                    String[] ignoreList)
             throws IOException,
                    MessagingException
See Also:
DataHandler.writeTo(java.io.OutputStream)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  

Popular Tags