Java Code Examples for javax.mail.MessagingException#toString()

The following examples show how to use javax.mail.MessagingException#toString() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SmtpMail.java    From uyuni with GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
public void send() {

    try {
        Address[] addrs = message.getRecipients(RecipientType.TO);
        if (addrs == null || addrs.length == 0) {
            log.warn("Aborting mail message " + message.getSubject() +
                    ": No recipients");
            return;
        }
        Transport.send(message);
    }
    catch (MessagingException me) {
        String msg = "MessagingException while trying to send email: " +
                             me.toString();
        log.warn(msg);
        throw new JavaMailException(msg, me);
    }
}
 
Example 2
Source File: SmtpMail.java    From uyuni with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Private helper method to do the heavy lifting of setting the recipients field for
 * a message
 * @param type The javax.mail.Message.RecipientType (To, CC, or BCC) for the recipients
 * @param recipIn A string array of email addresses
 */
private void setRecipients(RecipientType type, String[] recipIn) {
    log.debug("setRecipients called.");
    Address[] recAddr = null;
    try {
        List tmp = new LinkedList();
        for (int i = 0; i < recipIn.length; i++) {
            InternetAddress addr = new InternetAddress(recipIn[i]);
            log.debug("checking: " + addr.getAddress());
            if (verifyAddress(addr)) {
                log.debug("Address verified.  Adding: " + addr.getAddress());
                tmp.add(addr);
            }
        }
        recAddr = new Address[tmp.size()];
        tmp.toArray(recAddr);
        message.setRecipients(type, recAddr);
    }
    catch (MessagingException me) {
        String msg = "MessagingException while trying to send email: " +
                            me.toString();
        log.warn(msg);
        throw new JavaMailException(msg, me);
    }
}
 
Example 3
Source File: SmtpMail.java    From spacewalk with GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
public void send() {

    try {
        Address[] addrs = message.getRecipients(RecipientType.TO);
        if (addrs == null || addrs.length == 0) {
            log.warn("Aborting mail message " + message.getSubject() +
                    ": No recipients");
            return;
        }
        Transport.send(message);
    }
    catch (MessagingException me) {
        String msg = "MessagingException while trying to send email: " +
                             me.toString();
        log.warn(msg);
        throw new JavaMailException(msg, me);
    }
}
 
Example 4
Source File: SmtpMail.java    From spacewalk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Private helper method to do the heavy lifting of setting the recipients field for
 * a message
 * @param type The javax.mail.Message.RecipientType (To, CC, or BCC) for the recipients
 * @param recipIn A string array of email addresses
 */
private void setRecipients(RecipientType type, String[] recipIn) {
    log.debug("setRecipients called.");
    Address[] recAddr = null;
    try {
        List tmp = new LinkedList();
        for (int i = 0; i < recipIn.length; i++) {
            InternetAddress addr = new InternetAddress(recipIn[i]);
            log.debug("checking: " + addr.getAddress());
            if (verifyAddress(addr)) {
                log.debug("Address verified.  Adding: " + addr.getAddress());
                tmp.add(addr);
            }
        }
        recAddr = new Address[tmp.size()];
        tmp.toArray(recAddr);
        message.setRecipients(type, recAddr);
    }
    catch (MessagingException me) {
        String msg = "MessagingException while trying to send email: " +
                            me.toString();
        log.warn(msg);
        throw new JavaMailException(msg, me);
    }
}
 
Example 5
Source File: SmtpMail.java    From uyuni with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
public void setHeader(String name, String value) {
    try {
        message.setHeader(name, value);
    }
    catch (MessagingException me) {
        String msg = "MessagingException while trying to send email: " +
        me.toString();
        log.warn(msg);
        throw new JavaMailException(msg, me);
    }
}
 
Example 6
Source File: SmtpMail.java    From uyuni with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
public void setSubject(String subIn) {
    try {
        message.setSubject(subIn);
    }
    catch (MessagingException me) {
        String msg = "MessagingException while trying to send email: " +
                            me.toString();
        log.warn(msg);
        throw new JavaMailException(msg, me);
    }
}
 
Example 7
Source File: SmtpMail.java    From uyuni with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
public void setBody(String textIn) {
    try {
        message.setText(textIn);
    }
    catch (MessagingException me) {
        String msg = "MessagingException while trying to send email: " +
                            me.toString();
        log.warn(msg);
        throw new JavaMailException(msg, me);
    }
}
 
Example 8
Source File: SmtpMail.java    From spacewalk with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
public void setHeader(String name, String value) {
    try {
        message.setHeader(name, value);
    }
    catch (MessagingException me) {
        String msg = "MessagingException while trying to send email: " +
        me.toString();
        log.warn(msg);
        throw new JavaMailException(msg, me);
    }
}
 
Example 9
Source File: SmtpMail.java    From spacewalk with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
public void setSubject(String subIn) {
    try {
        message.setSubject(subIn);
    }
    catch (MessagingException me) {
        String msg = "MessagingException while trying to send email: " +
                            me.toString();
        log.warn(msg);
        throw new JavaMailException(msg, me);
    }
}
 
Example 10
Source File: SmtpMail.java    From spacewalk with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
public void setBody(String textIn) {
    try {
        message.setText(textIn);
    }
    catch (MessagingException me) {
        String msg = "MessagingException while trying to send email: " +
                            me.toString();
        log.warn(msg);
        throw new JavaMailException(msg, me);
    }
}