protected void setFrom(Email email, String from, String tenantId) { String fromAddress = null; if (from != null) { fromAddress = from; } else { // use default configured from address in process engine config if (tenantId != null && tenantId.length() > 0) { Map<String, MailServerInfo> mailServers = Context.getProcessEngineConfiguration().getMailServers(); if (mailServers != null && mailServers.containsKey(tenantId)) { MailServerInfo mailServerInfo = mailServers.get(tenantId); fromAddress = mailServerInfo.getMailServerDefaultFrom(); } } if (fromAddress == null) { fromAddress = Context.getProcessEngineConfiguration().getMailServerDefaultFrom(); } } try { email.setFrom(fromAddress); } catch (EmailException e) { throw new ActivitiException("Could not set " + from + " as from address in email", e); } }
email.setFrom(sender); email.setSubject(subject); email.setCharset("UTF-8");
email.setSmtpPort(state.getPropAsInt(ConfigurationKeys.EMAIL_SMTP_PORT_KEY)); email.setFrom(state.getProp(ConfigurationKeys.EMAIL_FROM_KEY)); if (state.contains(ConfigurationKeys.EMAIL_USER_KEY) && state.contains(ConfigurationKeys.EMAIL_PASSWORD_KEY)) { email.setAuthentication(state.getProp(ConfigurationKeys.EMAIL_USER_KEY),
email.setCharset(mail.getString("charset")); ifset("debug", p -> email.setDebug(mail.getBoolean(p))); ifset("from", p -> email.setFrom(mail.getString(p))); ifset("hostName", p -> email.setHostName(mail.getString(p))); ifset("msg", p -> {
/** * Set the FROM field of the email to use the specified address. The email * address will also be used as the personal name. * The name will be encoded by the charset of {@link #setCharset(java.lang.String) setCharset()}. * If it is not set, it will be encoded using * the Java platform's default charset (UTF-16) if it contains * non-ASCII characters; otherwise, it is used as is. * * @param email A String. * @return An Email. * @throws EmailException Indicates an invalid email address. * @since 1.0 */ public Email setFrom(final String email) throws EmailException { return setFrom(email, null); }
/** * Set the FROM field of the email to use the specified address and the * specified personal name. * The name will be encoded by the charset of {@link #setCharset(java.lang.String) setCharset()}. * If it is not set, it will be encoded using * the Java platform's default charset (UTF-16) if it contains * non-ASCII characters; otherwise, it is used as is. * * @param email A String. * @param name A String. * @return An Email. * @throws EmailException Indicates an invalid email address. * @since 1.0 */ public Email setFrom(final String email, final String name) throws EmailException { return setFrom(email, name, this.charset); }
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); }
protected void setFrom(Email email, String from) { String fromAddress = null; if (from != null) { fromAddress = from; } else { // use default configured from address in process engine config fromAddress = Context.getProcessEngineConfiguration().getMailServerDefaultFrom(); } try { email.setFrom(fromAddress); } catch (EmailException e) { throw LOG.addSenderException(from, e); } }
protected void setFrom(Email email, String from) { String fromAddress = null; if (from != null) { fromAddress = from; } else { // use default configured from address in process engine config fromAddress = Context.getProcessEngineConfiguration().getMailServerDefaultFrom(); } try { email.setFrom(fromAddress); } catch (EmailException e) { throw LOG.addSenderException(from, e); } }
email.setFrom(sender); email.setSubject(subject); email.setCharset("UTF-8");
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 email = new SimpleEmail(); String authuser = "...@gmail.com"; String authpwd = "xxxx"; email.setSmtpPort(587); email.setAuthenticator(new DefaultAuthenticator(authuser, authpwd)); email.setDebug(true); email.setHostName("smtp.gmail.com"); email.getMailSession().getProperties().put("mail.smtps.auth", "true"); email.getMailSession().getProperties().put("mail.debug", "true"); email.getMailSession().getProperties().put("mail.smtps.port", "587"); email.getMailSession().getProperties().put("mail.smtps.socketFactory.port", "587"); email.getMailSession().getProperties().put("mail.smtps.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); email.getMailSession().getProperties().put("mail.smtps.socketFactory.fallback", "false"); email.getMailSession().getProperties().put("mail.smtp.starttls.enable", "true"); email.setFrom("........@gmail.com", "SenderName"); email.setSubject("TestMail"); email.setMsg("This is a test mail?"); email.addTo("xxxx@gmail.com", "ToName"); email.setTLS(true); email.send();
Email email = new SimpleEmail(); email.setHostName("smtp.gmail.com"); email.setSmtpPort(465); email.setAuthenticator(new DefaultAuthenticator("username", "password")); email.setSSLOnConnect(true); email.setFrom("user@gmail.com"); email.setSubject("TestMail"); email.setMsg("This is a test mail ... :-)"); email.addTo("foo@bar.com"); email.send();
Email email = new SimpleEmail(); email.setHostName("smtp.gmail.com"); email.setSmtpPort(587); email.setAuthenticator(new DefaultAuthenticator("username", "password")); email.setStartTLSEnabled(true); email.setFrom("user@gmail.com"); email.setSubject("TestMail"); email.setMsg("This is a test mail ... :-)"); email.addTo("foo@bar.com"); email.send();
Email email = new SimpleEmail(); email.setHostName("smtp.googlemail.com"); email.setSmtpPort(465); email.setAuthenticator(new DefaultAuthenticator("username", "password")); email.setSSLOnConnect(true); email.setFrom("user@gmail.com"); email.setSubject("TestMail"); email.setMsg("This is a test mail ... :-)"); email.addTo("foo@bar.com"); email.send();
Email email = new SimpleEmail(); email.setHostName("smtp.googlemail.com"); email.setSmtpPort(465); email.setAuthenticator(new DefaultAuthenticator("username", "password")); email.setSSLOnConnect(true); email.setFrom("user@gmail.com"); email.setSubject("TestMail"); email.setMsg("This is a test mail ... :-)"); email.addTo("foo@bar.com"); email.send();
Email email = new SimpleEmail(); email.setHostName("smtp.googlemail.com"); email.setSmtpPort(465); email.setAuthenticator(new DefaultAuthenticator("username", "password")); email.setSSLOnConnect(true); email.setFrom("user@gmail.com"); email.setSubject("TestMail"); email.setMsg("This is a test mail ... :-)"); email.addTo("foo@bar.com"); email.send();
public static void main(String[] args) throws EmailException { Email email = new SimpleEmail(); email.setHostName("smtp.googlemail.com"); email.setSmtpPort(465); email.setAuthenticator(new DefaultAuthenticator("username", "password")); email.setSSLOnConnect(true); email.setFrom("user@gmail.com"); email.setSubject("TestMail"); email.setMsg("This is a test mail ... :-)"); email.addTo("foo@bar.com"); email.send(); } }
Email email = new SimpleEmail(); email.setHostName("smtp.googlemail.com"); email.setSmtpPort(465); email.setAuthenticator(new DefaultAuthenticator("username", "password")); email.setSSLOnConnect(true); email.setFrom("user@gmail.com"); email.setSubject("TestMail"); email.setMsg("This is a test mail ... :-)"); email.addTo("foo@bar.com"); email.send();