protected void addTo(Email email, String to) { String[] tos = splitAndTrim(to); if (tos != null) { for (String t : tos) { try { email.addTo(t); } catch (EmailException e) { throw new ActivitiException("Could not add " + t + " as recipient", e); } } } else { throw new ActivitiException("No recipient could be found for sending email"); } }
email.addTo(receiver);
Splitter.on(',').trimResults().omitEmptyStrings().split(state.getProp(ConfigurationKeys.EMAIL_TOS_KEY)); for (String to : tos) { email.addTo(to);
email.addTo(emailAddress);
/** * Add a recipient TO to the email. 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 addTo(final String email) throws EmailException { return addTo(email, null); }
/** * Add a recipient TO to the email using 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 addTo(final String email, final String name) throws EmailException { return addTo(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); }
/** * Add a list of TO recipients to the email. The email * addresses will also be used as the personal names. * The names 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 emails A String array. * @return An Email. * @throws EmailException Indicates an invalid email address. * @since 1.3 */ public Email addTo(final String... emails) throws EmailException { if (emails == null || emails.length == 0) { throw new EmailException("Address List provided was invalid"); } for (final String email : emails) { addTo(email, null); } return this; }
protected void addTo(Email email, String to) { String[] tos = splitAndTrim(to); if (tos != null) { for (String t : tos) { try { email.addTo(t); } catch (EmailException e) { throw LOG.addRecipientException(t, e); } } } else { throw LOG.missingRecipientsException(); } }
protected void addTo(Email email, String to) { String[] tos = splitAndTrim(to); if (tos != null) { for (String t : tos) { try { email.addTo(t); } catch (EmailException e) { throw LOG.addRecipientException(t, e); } } } else { throw LOG.missingRecipientsException(); } }
public void sendTextEmail(String targetAddress,String title,String content) throws Exception { Email email = new SimpleEmail(); email.setMsg(content); email.setSubject(title); email.addTo(targetAddress); sendEmail(email); }
email.addTo(receiver);
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();
@Override public void sendVerification(final EmailConfiguration configuration, final String address) throws EmailException { checkNotNull(configuration); checkNotNull(address); Email mail = new SimpleEmail(); mail.setSubject("Email configuration verification"); mail.addTo(address); mail.setMsg("Verification successful"); mail = apply(configuration, mail); mail.send(); }
private void sendNotificationEmail(List<EntityX> items) throws EmailException { Email email = new SimpleEmail(); email.setSubject("Notification about processing of ..."); email.addTo(data.getCustomerEmail()); // Other e-mail parameters, such as the host name of the mail server, have defaults defined through external // configuration. String message = buildNotificationMessage(items); email.setMsg(message); 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();