|
|
|
@ -416,12 +416,22 @@ public class RecuperarPassword extends AbstractPageBean {
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final String SMTP_HOST = "mail2.evolute.pt";
|
|
|
|
|
|
|
|
private final int SMTP_PORT = 587;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final String mail_username = "acidentes.auchan@siprp.pt";
|
|
|
|
|
|
|
|
private final String mail_password = "EghRzS2l";
|
|
|
|
|
|
|
|
|
|
|
|
private void sendEmail(String emailTo, String login, String password, String admin_email) throws Exception
|
|
|
|
private void sendEmail(String emailTo, String login, String password, String admin_email) throws Exception
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Properties props = new Properties();
|
|
|
|
Properties props = new Properties();
|
|
|
|
//props.put("mail.transport.protocol", "smtp");
|
|
|
|
//props.put("mail.transport.protocol", "smtp");
|
|
|
|
props.put("mail.smtp.host", "mail2.evolute.pt");
|
|
|
|
props.put("mail.smtp.host", SMTP_HOST );
|
|
|
|
props.put("mail.from", admin_email);
|
|
|
|
props.put("mail.from", admin_email );
|
|
|
|
|
|
|
|
props.put("mail.smtp.auth", "true");
|
|
|
|
|
|
|
|
props.put("mail.smtp.user", mail_username );
|
|
|
|
|
|
|
|
props.put("mail.smtp.password", mail_password );
|
|
|
|
Session session1 = Session.getInstance(props);
|
|
|
|
Session session1 = Session.getInstance(props);
|
|
|
|
Message msg = new MimeMessage(session1);
|
|
|
|
Message msg = new MimeMessage(session1);
|
|
|
|
|
|
|
|
|
|
|
|
@ -444,7 +454,15 @@ public class RecuperarPassword extends AbstractPageBean {
|
|
|
|
msgBodyPart.setContent(html, "text/html");
|
|
|
|
msgBodyPart.setContent(html, "text/html");
|
|
|
|
multipart.addBodyPart(msgBodyPart);
|
|
|
|
multipart.addBodyPart(msgBodyPart);
|
|
|
|
msg.setContent(multipart);
|
|
|
|
msg.setContent(multipart);
|
|
|
|
Transport.send(msg);
|
|
|
|
|
|
|
|
|
|
|
|
// Transport.send(msg);
|
|
|
|
|
|
|
|
Transport t;
|
|
|
|
|
|
|
|
t = session1.getTransport( "smtp" );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
t.connect( SMTP_HOST, SMTP_PORT, mail_username, mail_password );
|
|
|
|
|
|
|
|
t.sendMessage( msg, msg.getAllRecipients() );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
t.close();
|
|
|
|
System.out.println("Email Enviado !!!! " + emailTo + ", " + login);
|
|
|
|
System.out.println("Email Enviado !!!! " + emailTo + ", " + login);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// catch (Exception ex)
|
|
|
|
// catch (Exception ex)
|
|
|
|
|