]> matita.cs.unibo.it Git - logicplayer.git/blobdiff - server/com/company/EmailSender.java
Now uses localhost to send e-mail.
[logicplayer.git] / server / com / company / EmailSender.java
index 1abf701b2246c8475f59ee355691a9c7ad55838f..d21d4374580f0a05b942d183c9d605a58272a700 100644 (file)
@@ -42,20 +42,20 @@ public class EmailSender {
  
   // 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);
@@ -91,10 +91,12 @@ public class EmailSender {
       // 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");