Package javax.mail

Examples of javax.mail.MessagingException


            if (this.session.getDebug()) {
                this.session.getDebugOut().println("error connecting to " + mail_host);
            }

            throw new MessagingException("Error connecting to " + mail_host, e);
        }

        return s;
    }
View Full Code Here


                partStream = new MimeBodyPartInputStream(pushbackInStream,
                        boundary);
                addBodyPart(new MimeBodyPart(partStream));
            }
        } catch (Exception e){
            throw new MessagingException(e.toString(),e);
        }
        parsed = true;
    }
View Full Code Here

                    int boundaryIndex = 0;
                    while (pushbackInStream.available() > 0 && (boundaryIndex < boundary.length)
                            && ((byte) value == boundary[boundaryIndex])) {
                        value = pushbackInStream.read();
                        if (value == -1)
                            throw new MessagingException(
                                    "Unexpected End of Stream while searching for first Mime Boundary");
                        boundaryIndex++;
                    }
                    if (boundaryIndex == boundary.length) { // boundary found
                        pushbackInStream.read();
                        return true;
                    }
                }
            }
        } catch (IOException ioe) {
            throw new MessagingException(ioe.toString(), ioe);
        }
        return false;
    }
View Full Code Here

            if (part instanceof MimeMessage) {
                stream = ((MimeMessage) part).getContentStream();
            } else if (part instanceof MimeBodyPart) {
                stream = ((MimeBodyPart) part).getContentStream();
            } else {
                throw new MessagingException("Unknown part");
            }
            String encoding = part.getEncoding();
            return encoding == null ? stream : MimeUtility.decode(stream, encoding);
        } catch (MessagingException e) {
            throw (IOException) new IOException(e.getMessage()).initCause(e);
View Full Code Here

        int count;
        try {
            while((count = in.read(buffer, 0, 1024)) != -1)
                baos.write(buffer, 0, count);
        } catch (IOException e) {
            throw new MessagingException(e.toString(),e);
        }
        content = baos.toByteArray();
    }
View Full Code Here

    protected InputStream getContentStream() throws MessagingException {
        if (content != null) {
            return new ByteArrayInputStream(content);
        } else {
            throw new MessagingException("No content");
        }
    }
View Full Code Here

            }
            if (name.length() > 0) {
                addHeader(name.toString().trim(), value.toString().trim());
            }
        } catch (IOException e) {
            throw new MessagingException("Error loading headers", e);
        }
    }
View Full Code Here

            int count;
            while ((count = in.read(buffer, 0, 1024)) != -1) {
                baos.write(buffer, 0, count);
            }
        } catch (Exception e) {
            throw new MessagingException(e.toString(), e);
        }
        content = baos.toByteArray();
    }
View Full Code Here

    public void setSubject(String subject, String charset) throws MessagingException {
        try {
            setHeader("Subject", MimeUtility.encodeText(subject, charset, null));
        } catch (UnsupportedEncodingException e) {
            throw new MessagingException(e.getMessage(), e);
        }
    }
View Full Code Here

    protected InputStream getContentStream() throws MessagingException {
        if (content != null) {
            return new ByteArrayInputStream(content);
        } else {
            throw new MessagingException("No content");
        }
    }
View Full Code Here

TOP

Related Classes of javax.mail.MessagingException

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.