use of lucee.runtime.net.mail.ServerImpl in project Lucee by lucee.
the class SMTPClient method toServerImpl.
public static ServerImpl toServerImpl(String server, int port, String usr, String pwd, long lifeTimespan, long idleTimespan) throws MailException {
int index;
// username/password
index = server.indexOf('@');
if (index != -1) {
usr = server.substring(0, index);
server = server.substring(index + 1);
index = usr.indexOf(':');
if (index != -1) {
pwd = usr.substring(index + 1);
usr = usr.substring(0, index);
}
}
// port
index = server.indexOf(':');
if (index != -1) {
try {
port = Caster.toIntValue(server.substring(index + 1));
} catch (ExpressionException e) {
throw new MailException(e.getMessage());
}
server = server.substring(0, index);
}
ServerImpl srv = ServerImpl.getInstance(server, port, usr, pwd, lifeTimespan, idleTimespan, false, false);
return srv;
}
Aggregations