|
|
|
|
@ -59,6 +59,7 @@ import javax.mail.BodyPart;
|
|
|
|
|
import javax.mail.Message;
|
|
|
|
|
import javax.mail.Multipart;
|
|
|
|
|
import javax.mail.Session;
|
|
|
|
|
import javax.mail.Transport;
|
|
|
|
|
import javax.mail.internet.InternetAddress;
|
|
|
|
|
import javax.mail.internet.MimeBodyPart;
|
|
|
|
|
import javax.mail.internet.MimeMessage;
|
|
|
|
|
@ -14256,10 +14257,12 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean {
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
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 = "47Ju6Vb";
|
|
|
|
|
|
|
|
|
|
// private final String mail_bcc = "departamentotecnico@siprp.pt";
|
|
|
|
|
private final String mail_bcc = "acidentes.auchan@siprp.pt";
|
|
|
|
|
private final String mail_bcc2 = "siprp.aat@evolute.pt";
|
|
|
|
|
|
|
|
|
|
@ -14272,14 +14275,15 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean {
|
|
|
|
|
{
|
|
|
|
|
Properties props = new Properties();
|
|
|
|
|
//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", emailFrom);
|
|
|
|
|
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);
|
|
|
|
|
Authenticator auth = new SMTPAuthenticator();
|
|
|
|
|
Session session = Session.getDefaultInstance(props, auth);
|
|
|
|
|
// Session session = Session.getDefaultInstance(props, auth);
|
|
|
|
|
Session session = Session.getDefaultInstance( props );
|
|
|
|
|
|
|
|
|
|
Message msg = new MimeMessage(session);
|
|
|
|
|
msg.setFrom(new InternetAddress(emailFrom));
|
|
|
|
|
@ -14303,7 +14307,14 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean {
|
|
|
|
|
msgBodyPart.setContent(html, "text/html");
|
|
|
|
|
multipart.addBodyPart(msgBodyPart);
|
|
|
|
|
msg.setContent(multipart);
|
|
|
|
|
Transport.send(msg);
|
|
|
|
|
// Transport.send(msg);
|
|
|
|
|
Transport t;
|
|
|
|
|
t = session.getTransport( "smtp" );
|
|
|
|
|
|
|
|
|
|
t.connect( SMTP_HOST, SMTP_PORT, mail_username, mail_password );
|
|
|
|
|
t.sendMessage( msg, msg.getAllRecipients() );
|
|
|
|
|
|
|
|
|
|
t.close();
|
|
|
|
|
System.out.println("Email Enviado !!!!" );
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
@ -14384,7 +14395,14 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean {
|
|
|
|
|
pdfPart.setFileName(pdfname);
|
|
|
|
|
multipart.addBodyPart(pdfPart,1);
|
|
|
|
|
msg.setContent(multipart);
|
|
|
|
|
Transport.send(msg);
|
|
|
|
|
// Transport.send(msg);
|
|
|
|
|
Transport t;
|
|
|
|
|
t = session.getTransport( "smtp" );
|
|
|
|
|
|
|
|
|
|
t.connect( SMTP_HOST, SMTP_PORT, mail_username, mail_password );
|
|
|
|
|
t.sendMessage( msg, msg.getAllRecipients() );
|
|
|
|
|
|
|
|
|
|
t.close();
|
|
|
|
|
System.out.println("Email Pdf Enviado !!!! " + emailTo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|