if (type == ConfigurationType.MAIL_PROPERTIES) {
// Configure transport ourselves using mail properties
transport = session.getTransport("smtp");
if (mailUsername != null && mailPassword != null && mailPort != -1) {
transport.connect(mailHostname, mailPort, mailUsername, mailPassword);
} else if (mailUsername != null && mailPassword != null) {
transport.connect(mailHostname, mailUsername, mailPassword);
} else {
transport.connect();
}