Package javax.mail.internet

Examples of javax.mail.internet.InternetHeaders


      DebugFile.incIdent();
    }

  int iAffected = 0
  DispositionNotification oRpt = (DispositionNotification) oCnt.getReport();
  InternetHeaders oInetHdrs = oRpt.getNotifications();                       
    String sHeader = oInetHdrs.getHeader("Disposition", null);

  if (DebugFile.trace) DebugFile.writeln("Disposition: "+sHeader);
   
  if (sHeader!=null) {
      if (sHeader.endsWith("displayed")) {           
        String sSQL = "UPDATE "+DB.k_inet_addrs+ " SET "+DB.dt_displayed+"=";
        PreparedStatement oUpdt = oCon.prepareStatement("UPDATE "+DB.k_inet_addrs+ " SET "+DB.dt_displayed+"=?,"+DB.user_agent+"=? WHERE "+DB.id_message+"=? AND "+DB.tx_email+"=?");
    Timestamp oTs = new Timestamp(new Date().getTime());
    oUpdt.setTimestamp(1, oTs);
        sSQL+=oTs.toString()+","+DB.user_agent+"=";
        sHeader = oInetHdrs.getHeader("Reporting-UA", null);
    if (null==sHeader) {
      sSQL+="null";
          oUpdt.setNull(2, Types.VARCHAR);
    } else {
      sSQL+="'"+Gadgets.left(sHeader, 254)+"'";
      oUpdt.setString(2, Gadgets.left(sHeader, 254));
        }
        String sMsgId = oInetHdrs.getHeader("Original-Message-ID",null);
    sSQL+=" WHERE "+DB.id_message+"='"+sMsgId+"' AND ";
        oUpdt.setString(3, sMsgId);
    String sTxEmail = oInetHdrs.getHeader("Final-Recipient", null);
    if (sTxEmail.indexOf(';')>0)
      sTxEmail = Gadgets.split2(sTxEmail,';')[1];
      sSQL+=DB.tx_email+"='"+sTxEmail+"'";
      oUpdt.setString(4, sTxEmail);
      if (DebugFile.trace) {
View Full Code Here


  /**
   * Parses the Enumeration of Header objects into a HashMap.
   */
  private InternetHeaders parseHeaders(Enumeration pHeaders) {
    InternetHeaders retVal = new InternetHeaders();
    while (pHeaders.hasMoreElements()) {
      Header hdr = (Header) pHeaders.nextElement();
      retVal.addHeader(hdr.getName(), hdr.getValue());
    }

    return retVal;
  }
View Full Code Here

    try {
      if (getNewMessageUI() != null) {
        getNewMessageUI().setBusy(true);
        UserProfile profile = getNewMessageUI().getSelectedProfile();
        InternetHeaders headers = getNewMessageUI().getMessageHeaders();

        String messageText = getNewMessageUI().getMessageText();

        String messageContentType = getNewMessageUI().getMessageContentType();
View Full Code Here

    try {
      if (getNewMessageUI() != null) {
        getNewMessageUI().setBusy(true);

        final UserProfile profile = getNewMessageUI().getSelectedProfile();
        final InternetHeaders headers = getNewMessageUI().getMessageHeaders();

        final String messageText = getNewMessageUI().getMessageText();

        final String messageContentType = getNewMessageUI().getMessageContentType();
View Full Code Here

  /**
   * This returns the values in the MesssageWindow as a set of
   * InternetHeaders.
   */
  public InternetHeaders getMessageHeaders() throws MessagingException {
    InternetHeaders returnValue = new InternetHeaders();
    String key;

    Enumeration keys = inputTable.keys();
    while (keys.hasMoreElements()) {
      key = (String)(keys.nextElement());

      if (! key.equals("UserProfile")) {
        String header = new String(Pooka.getProperty("MessageWindow.Header." + key + ".MIMEHeader", key));

        EntryTextArea inputField = (EntryTextArea) inputTable.get(key);
        String value = null;
        if (inputField instanceof AddressEntryTextArea) {
          value = ((AddressEntryTextArea) inputField).getParsedAddresses();
          value = ((NewMessageInfo)getMessageProxy().getMessageInfo()).convertAddressLine(value, getSelectedProfile());
        } else {
          value = ((EntryTextArea)(inputTable.get(key))).getText();
          value = value.replaceAll("\n", " ");
        }

        // don't set it if it's blank.
        if (value != null && value.length() > 0) {
          returnValue.setHeader(header, value);
        }
      }
    }

    if (customHeaderButton.isSelected()) {
      populateCustomHeaders(returnValue);
    } else {
      UserProfile p = getSelectedProfile();
      p.populateHeaders(returnValue);
      returnValue.setHeader(Pooka.getProperty("Pooka.userProfileProperty", "X-Pooka-UserProfile"), p.getName());
    }

    return returnValue;
  }
View Full Code Here

                    (mail.getSender() == null ? "<>" : "<" + mail.getSender()
                            + ">"));
        }

        Enumeration headers;
        InternetHeaders deliveredTo = new InternetHeaders();
        if (deliveryHeader != null) {
            // Copy any Delivered-To headers from the message
            headers = message
                    .getMatchingHeaders(new String[] { deliveryHeader });
            while (headers.hasMoreElements()) {
                Header header = (Header) headers.nextElement();
                deliveredTo.addHeader(header.getName(), header.getValue());
            }
        }

        for (Iterator i = recipients.iterator(); i.hasNext();) {
            MailAddress recipient = (MailAddress) i.next();
            try {
                if (deliveryHeader != null) {
                    // Add qmail's de facto standard Delivered-To header
                    message.addHeader(deliveryHeader, recipient.toString());
                }

                storeMail(mail.getSender(), recipient, mail);

                if (deliveryHeader != null) {
                    if (i.hasNext()) {
                        // Remove headers but leave all placeholders
                        message.removeHeader(deliveryHeader);
                        headers = deliveredTo.getAllHeaders();
                        // And restore any original Delivered-To headers
                        while (headers.hasMoreElements()) {
                            Header header = (Header) headers.nextElement();
                            message.addHeader(header.getName(), header
                                    .getValue());
View Full Code Here

                throw new IOException("Couldn't find MIME boundary: " + new String(boundary));
            }

            try {
                // TODO: Do we need to copy these headers somewhere?
                new InternetHeaders(stream);
            } catch (MessagingException e) {
                throw new RuntimeException(e);
            }

            body = new DelegatingInputStream(new MimeBodyPartInputStream(stream, boundary));
View Full Code Here

            return null;
        }
        stream.unread(v);


        InternetHeaders headers;
        try {
            headers = new InternetHeaders(stream);
        } catch (MessagingException e) {
            // TODO create custom IOException
            throw new RuntimeException(e);
        }

        String id = headers.getHeader("Content-ID", null);
        if (id != null && id.startsWith("<")) {
            id = id.substring(1, id.length() - 1);
        } else {
            //no Content-ID, set cxf default ID
            id = "Content-ID: <root.message@cxf.apache.org";
View Full Code Here

     * @see org.apache.james.nntpsever.repository.NNTPArticle#getHeader(String)
     */
    public String getHeader(String header) {
        try {
            FileInputStream fin = new FileInputStream(articleFile);
            InternetHeaders hdr = new InternetHeaders(fin);
            fin.close();
            return hdr.getHeader(header,null);
        } catch(Exception ex) {
            throw new NNTPException(ex);
        }
    }
View Full Code Here

            final String contentType = layout.getContentType();
            final String encoding = getEncoding(rawBytes, contentType);
            final byte[] encodedBytes = encodeContentToBytes(rawBytes, encoding);

            final InternetHeaders headers = getHeaders(contentType, encoding);
            final MimeMultipart mp = getMimeMultipart(encodedBytes, headers);

            sendMultipartMessage(message, mp);
        } catch (final MessagingException e) {
            LOGGER.error("Error occurred while sending e-mail notification.", e);
View Full Code Here

TOP

Related Classes of javax.mail.internet.InternetHeaders

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.