Java Email Send sendResetPasswordMail(String to, String message)

Here you can find the source of sendResetPasswordMail(String to, String message)

Description

send Reset Password Mail

License

Open Source License

Declaration

public static void sendResetPasswordMail(String to, String message) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static void sendResetPasswordMail(String to, String message) {
        sendMail("correo.cipf.es", to, "babelomics@cipf.es", "Genomic cloud storage analysis password reset",
                message.toString());/*w w  w . java  2s .com*/
    }

    public static void sendMail(String smtpServer, String to, String from, String subject, String body) {
        try {
            //         Properties props = System.getProperties();
            //         // -- Attaching to default Session, or we could start a new one --
            //         props.put("mail.smtp.host", smtpServer);
            //         javax.mail.Session session = javax.mail.Session.getDefaultInstance(props, null);
            //         // -- Create a new message --
            //         // Message msg = new javax.mail.Message(session);
            //         Message msg = new MimeMessage(session);
            //         // -- Set the FROM and TO fields --
            //         msg.setFrom(new InternetAddress(from));
            //         msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse(to, false));
            //         // -- We could include CC recipients too --
            //         // if (cc != null)
            //         // msg.setRecipients(Message.RecipientType.CC
            //         // ,InternetAddress.parse(cc, false));
            //         // -- Set the subject and body text --
            //         msg.setSubject(subject);
            //         msg.setText(body);
            //         // -- Set some other header information --
            //         msg.setHeader("X-Mailer", "LOTONtechEmail");
            //         msg.setSentDate(new Date());
            //         // -- Send the message --
            //         Transport.send(msg);
            System.out.println("Message sent OK.");
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
}

Related

  1. sendMail(String toEmailId, String subject, String msgText, String from, String smtpServer, String userName, String password)
  2. sendMail(String vmName, String property, String emailId, boolean usageHigh)
  3. sendMessage(Message message)
  4. sendMessage(Message msg, Transport transport)
  5. sendMimeMessage(MimeMessage mimeMessage)
  6. sendResetPasswordMail(String to, String newPassword, final String mailUser, final String mailPassword, String mailHost, String mailPort)