Search in sources :

Example 1 with InvalidAddressException

use of com.outjected.email.api.InvalidAddressException in project simple-email by codylerum.

the class MailUtility method internetAddress.

public static InternetAddress internetAddress(String address, String name) throws InvalidAddressException {
    InternetAddress internetAddress;
    try {
        internetAddress = new InternetAddress(address);
        internetAddress.setPersonal(name);
        return internetAddress;
    } catch (AddressException e) {
        throw new InvalidAddressException(e);
    } catch (UnsupportedEncodingException e) {
        throw new InvalidAddressException(e);
    }
}
Also used : InternetAddress(javax.mail.internet.InternetAddress) AddressException(javax.mail.internet.AddressException) InvalidAddressException(com.outjected.email.api.InvalidAddressException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) InvalidAddressException(com.outjected.email.api.InvalidAddressException)

Aggregations

InvalidAddressException (com.outjected.email.api.InvalidAddressException)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 AddressException (javax.mail.internet.AddressException)1 InternetAddress (javax.mail.internet.InternetAddress)1