public Mail(Avaliacao av, ArrayList<Avaliacao> avs,String titlo){
t = new Thread(){
@Override
public void run(){
System.out.println("Inicou");
//Separa os itens da informaçao do sender
String email = av.email;
String title = titlo;
String filename = "doc.pdf";
//Loga no email do sender
String Email = "email";
String Senha = "senha";
//Loga no smtp do email
MultiPartEmail mail = new MultiPartEmail();
mail.setHostName("smtp.gmail.com");
mail.setSmtpPort(465);
mail.setAuthentication(Email, Senha);
mail.setSSLOnConnect(true);
try {
mail.setFrom(Email);
mail.addTo(email);
mail.setSubject(title);
File file = new File(filename);
EmailAttachment attachment = new EmailAttachment();
attachment.setPath(file.getPath());
attachment.setName(file.getName());
mail.attach(attachment);
mail.send();
} catch (Exception e) {
System.out.println(e);
}
stop();
}
};
}