// Metodo che si occupa dell'invio effettivo della mail
public void inviaEmail() {
- int port = 465; //porta 25 per non usare SSL
+ int port = 25; //porta 465 per usare SSL
Properties props = new Properties();
- props.put("mail.smtp.auth", "true");
+ props.put("mail.smtp.auth", "false"); /* true to autenticate */
props.put("mail.smtp.user", mittente);
props.put("mail.smtp.host", host);
props.put("mail.smtp.port", port);
// commentare la riga seguente per non usare SSL
- props.put("mail.smtp.starttls.enable","true");
+ //props.put("mail.smtp.starttls.enable","true");
props.put("mail.smtp.socketFactory.port", port);
// commentare la riga seguente per non usare SSL
- props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
+ //props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
props.put("mail.smtp.socketFactory.fallback", "false");
Session session = Session.getInstance(props, null);
// inserimento delle parti nel messaggio
msg.setContent(multipart);
- Transport transport = session.getTransport("smtps"); //("smtp") per non usare SSL
+ /*CSC: this code was for handling SMTP authentication
+ Transport transport = session.getTransport("smtp"); //("smtps") per usare SSL
transport.connect(host, user, password);
transport.sendMessage(msg, msg.getAllRecipients());
- transport.close();
+ transport.close();*/
+ Transport.send(msg, msg.getAllRecipients());
System.out.println("Invio dell'email Terminato");