Examples of WGMailException


Examples of de.innovationgate.webgate.api.mail.WGMailException

    }

    public WGMail createMail(String mimeType) throws WGMailException {
       
        if (_core.getMailConfig() == null) {
            throw new WGMailException("No mail configuration available");
        }
       
        try {
            Mail mail = new Mail(_core.getMailConfig());
            mail.setMimeType(mimeType);
            return mail;
        }
        catch (UnsupportedEncodingException e) {
            throw new WGMailException("Exception creating mail object", e);
        }
       
    }
View Full Code Here

Examples of de.innovationgate.webgate.api.mail.WGMailException

            // Send mail
            send(message);

        }
        catch (MessagingException e) {
            throw new WGMailException("Exception sending SMTP mail", e);
        }
    }
View Full Code Here

Examples of de.innovationgate.webgate.api.mail.WGMailException

    @CodeCompletion
    public Message prepareMessage() throws WGMailException, MessagingException, AddressException {
        try {
            Session session = _mailConfig.createMailSession();
            if (session == null) {
                throw new WGMailException("MAIL ERROR: Can't open session.");
            }

            // Set headers of the mail
            MimeMessage message = new MimeMessage(session);
          message.setFrom(_from);

            // message.setReplyTo( Address[] );

            /*
             * Could use alias names: Address address = new
             * InternetAddress("president@whitehouse.gov", "Barack Obama");
             */

            if (_to != null && !_to.isEmpty()) {
                message.addRecipients(Message.RecipientType.TO, _to.toArray(new InternetAddress[_to.size()]));
            }
            else {
                throw new WGMailException("MAIL ERROR: No address to send mail to.");

            }

            if (_cc != null && !_cc.isEmpty()) {
                message.addRecipients(Message.RecipientType.CC, _cc.toArray(new InternetAddress[_cc.size()]));
View Full Code Here

Examples of de.innovationgate.webgate.api.mail.WGMailException

                URL fileURL;
                try {
                    fileURL = new URL(sFileURL);
                }
                catch (MalformedURLException e1) {
                    throw new WGMailException("Exception attaching file from URL " + sFileURL, e1);
                }

                // check if we have an alternate filename for this url
                String altFilename = (String) _attachmentURLs.get(sFileURL);
                String filename = null;
View Full Code Here

Examples of de.innovationgate.webgate.api.mail.WGMailException

                    _tempfiles = new ArrayList();
                }
                _tempfiles.add(temp);
        }
        catch (IOException e) {
            throw new WGMailException("Unable to create tempfile for attachment '" + filename + "'.", e);       
        }
       
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.