Java Utililty Methods Email Send

List of utility methods to do Email Send

Description

The list of methods to do Email Send are organized into topic(s).

Method

voidsendMessage(Message msg, Transport transport)
Send the message
if (msg.getAllRecipients() != null) {
    transport.sendMessage(msg, msg.getAllRecipients());
} else {
    throw new AddressException("Mail adress is null");
voidsendMimeMessage(MimeMessage mimeMessage)
Send the message using the JavaMail session defined in the message
try {
    Transport.send(mimeMessage);
} catch (MessagingException e) {
    throw new RuntimeException(e);
voidsendResetPasswordMail(String to, String message)
send Reset Password Mail
sendMail("correo.cipf.es", to, "babelomics@cipf.es", "Genomic cloud storage analysis password reset",
        message.toString());
voidsendResetPasswordMail(String to, String newPassword, final String mailUser, final String mailPassword, String mailHost, String mailPort)
send Reset Password Mail
Properties props = new Properties();
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.starttls.enable", "true");
props.put("mail.smtp.host", mailHost);
props.put("mail.smtp.port", mailPort);
Session session = Session.getInstance(props, new javax.mail.Authenticator() {
    protected PasswordAuthentication getPasswordAuthentication() {
        return new PasswordAuthentication(mailUser, mailPassword);
...