email.setAuthentication(username, password);
email.setAuthentication(state.getProp(ConfigurationKeys.EMAIL_USER_KEY), PasswordManager.getInstance(state).readPassword(state.getProp(ConfigurationKeys.EMAIL_PASSWORD_KEY)));
public <T extends Email> T newEmail(final T email) { try { ifset("username", p -> email.setAuthentication(mail.getString(p), mail.getString("password")));
private static void configEmail(String subject, Email email, String... recipients) throws EmailException { if (recipients == null) throw new EmailException("Recipients not found."); Mail mail = MailPlugin.getMail(); email.setCharset(mail.getCharset()); email.setSocketTimeout(mail.getTimeout()); email.setSocketConnectionTimeout(mail.getConnectout()); email.setHostName(mail.getHost()); if (!mail.getSslport().isEmpty()) email.setSslSmtpPort(mail.getSslport()); if (!mail.getPort().isEmpty()) email.setSmtpPort(Integer.parseInt(mail.getPort())); email.setSSLOnConnect(mail.isSsl()); email.setStartTLSEnabled(mail.isTls()); email.setDebug(mail.isDebug()); email.setAuthentication(mail.getUser(), mail.getPassword()); email.setFrom(mail.getFrom(), mail.getName()); email.setSubject(subject); email.addTo(recipients); }
String password = mailServerInfo.getMailServerPassword(); if (user != null && password != null) { email.setAuthentication(user, password); String password = processEngineConfiguration.getMailServerPassword(); if (user != null && password != null) { email.setAuthentication(user, password);
public void sendEmail(Email email) throws Exception { email.setAuthentication(username, password); email.setCharset(DEFAULT_CHARSET); email.setFrom(fromAddress); email.setSSLOnConnect(sslOn); email.setHostName(hostName); email.setSmtpPort(smtpPort); email.send(); }
email.setHostName(host); if (username != null && username.trim().length() > 0) { email.setAuthentication(username, password);
protected void setMailServerProperties(Email email) { ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration(); String host = processEngineConfiguration.getMailServerHost(); ensureNotNull("Could not send email: no SMTP host is configured", "host", host); email.setHostName(host); int port = processEngineConfiguration.getMailServerPort(); email.setSmtpPort(port); email.setTLS(processEngineConfiguration.getMailServerUseTLS()); String user = processEngineConfiguration.getMailServerUsername(); String password = processEngineConfiguration.getMailServerPassword(); if (user != null && password != null) { email.setAuthentication(user, password); } }
protected void setMailServerProperties(Email email) { ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration(); String host = processEngineConfiguration.getMailServerHost(); ensureNotNull("Could not send email: no SMTP host is configured", "host", host); email.setHostName(host); int port = processEngineConfiguration.getMailServerPort(); email.setSmtpPort(port); email.setTLS(processEngineConfiguration.getMailServerUseTLS()); String user = processEngineConfiguration.getMailServerUsername(); String password = processEngineConfiguration.getMailServerPassword(); if (user != null && password != null) { email.setAuthentication(user, password); } }
private void initEmail(Email email,String fromEmail, String fromPasswd,String fromName, String host,List<String> toEmailList,MailMsg mailMsg) throws EmailException{ email.setHostName(host); //邮件服务器验证:用户名/密码 email.setAuthentication(fromEmail, fromPasswd); //必须放在前面,否则乱码 email.setCharset(MailCfg.CHARSET); email.setDebug(false);//是否开启调试默认不开启 email.setSSLOnConnect(true);//开启SSL加密 email.setStartTLSEnabled(true);//开启TLS加密 email.addTo(toEmailList.toArray(new String[0])); email.setFrom(fromEmail,fromName); email.setSubject(mailMsg.getSubject()); } }
mail.setSmtpPort(configuration.getPort()); if (!Strings.isNullOrEmpty(configuration.getUsername()) || !Strings.isNullOrEmpty(configuration.getPassword())) { mail.setAuthentication(configuration.getUsername(), configuration.getPassword());
public void sendEmail(final Email email) throws EmailException { email.setHostName(hostname); if (ssl != null) email.setSSLOnConnect(ssl); if (start_tls_enabled != null) email.setStartTLSEnabled(start_tls_enabled); if (start_tls_required != null) email.setStartTLSRequired(start_tls_required); if (port != null) email.setSmtpPort(port); if (username != null) email.setAuthentication(username, password); if (connection_timeout != null) email.setSocketConnectionTimeout(connection_timeout); if (timeout != null) email.setSocketTimeout(timeout); email.send(); }
void send(String subject, String msg, String... to) { String[] clearTo = removeInvalidEmails(to); if (isActive()) { try { Email email = createSimpleMailService(); email.setHostName(host); email.setFrom(from); email.setSubject(subjectPrefix + " " + subject); email.setMsg(msg); email.addTo(clearTo); if (this.authenticationEnabled) { email.setAuthentication(this.userName, this.password); } email.setSSLOnConnect(sslEnabled); email.send(); } catch (EmailException mailExcp) { LOGGER.error("Email could not be send because of " + mailExcp.getMessage(),mailExcp); throw new WasabiEmailException("Email: " + emailToString(subject, msg, to) + " could not be sent.", mailExcp); } } else { //if the service is not active log the email that would have been send and throw error LOGGER.info("EmailService would have sent: " + emailToString(subject, msg, to)); throw new WasabiEmailException(ErrorCode.EMAIL_NOT_ACTIVE_ERROR, "The EmailService is not active."); } }
protected void setMailServerProperties(Email email) { ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration(); String host = processEngineConfiguration.getMailServerHost(); ensureNotNull("Could not send email: no SMTP host is configured", "host", host); email.setHostName(host); int port = processEngineConfiguration.getMailServerPort(); email.setSmtpPort(port); email.setTLS(processEngineConfiguration.getMailServerUseTLS()); String user = processEngineConfiguration.getMailServerUsername(); String password = processEngineConfiguration.getMailServerPassword(); if (user != null && password != null) { email.setAuthentication(user, password); } }
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(userName)) { mail.setAuthentication(userName, host.getPassword());
protected void sendEmail(Email email) throws EmailException { email.setHostName(config.getHostName()); email.setSmtpPort(config.getPort()); email.setStartTLSEnabled(config.isTLS()); if (Strings.hasText(config.getUsername())) { email.setAuthentication(config.getUsername(), config.getPassword()); } if (config.isSSL()) { email.setSSLOnConnect(config.isSSL()); email.setSslSmtpPort(Integer.toString(config.getPort())); email.setSSLCheckServerIdentity(config.isSSLCheckServerIdentity()); } email.send(); }
protected void sendEmail(Email email) throws EmailException { email.setHostName(config.getHostName()); email.setSmtpPort(config.getPort()); email.setStartTLSEnabled(config.isTLS()); if (Strings.hasText(config.getUsername())) { email.setAuthentication(config.getUsername(), config.getPassword()); } if (config.isSSL()) { email.setSSLOnConnect(config.isSSL()); email.setSslSmtpPort(Integer.toString(config.getPort())); email.setSSLCheckServerIdentity(config.isSSLCheckServerIdentity()); } email.send(); }
protected void setMailServerProperties(Email email) { ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration(); String host = processEngineConfiguration.getMailServerHost(); if (host == null) { throw new ActivitiException("Could not send email: no SMTP host is configured"); } email.setHostName(host); int port = processEngineConfiguration.getMailServerPort(); email.setSmtpPort(port); email.setSSL(processEngineConfiguration.getMailServerUseSSL()); email.setTLS(processEngineConfiguration.getMailServerUseTLS()); String user = processEngineConfiguration.getMailServerUsername(); String password = processEngineConfiguration.getMailServerPassword(); if (user != null && password != null) { email.setAuthentication(user, password); } }
email.setSmtpPort(config.getSmtpPort()); if (config.useSmtpAuth()) { email.setAuthentication(config.getSmtpUserName(), config.getSmtpPassword());
email.setHostName(smtpHost); if (smtpUsername != null || smtpPassword != null) { email.setAuthentication(smtpUsername, smtpPassword);