1 Reply Latest reply: Aug 3, 2014 11:51 PM by samsandwich RSS

    PS script that emails after completion?

    samsandwich

      Hello, I have this script it's suppose to mail the PS document:

       

      Header 1

      var mailServer = "mail_Server_name";

      var mailAddress = "E-Mail-Address";

      var mailTitle = "Results of script";

      var mailText = "Script completed at " + new Date();

      printText = false; //True print results to Console.

       

      sendmail(mailServer, mailAddress,mailTitle,mailText);

       

      function sendmail(mailServer, mailAddress,mailTitle,mailText){

          var sObj = new Socket();

          if (sObj.open(mailServer+":25")) {

              sObj.writeln("HELO "+mailServer);

              var txt = sObj.read()+"\n";

              sObj.writeln("MAIL From: " + mailAddress);

              txt += sObj.read()+"\n";

              sObj.writeln("RCPT To: "+mailAddress);

              txt += sObj.read()+"\n";

              sObj.writeln("DATA");

              sObj.writeln("From: Photoshop");

              txt += sObj.read()+"\n";

              sObj.writeln("To: "+mailAddress);

              txt += sObj.read()+"\n";

              sObj.writeln("Subject: "+mailTitle);

              txt += sObj.read()+"\n";

              sObj.writeln(mailText);

              txt += sObj.read()+"\n";

              sObj.writeln(".");

              txt += sObj.read()+"\n";

              sObj.writeln("QUIT");

              txt += sObj.read()+"\n";

      if(printText) $.writeln(txt);

              sObj.close();

          }

      }

       

      I have it at the end of a previously working script. It does not give me any errors or anything but it also doesn't do anything. I filled in the variables for my email/results etc...and I tried ismtp.gmail.com for the mail_server_name. I think that is my problem, I'm not entirely sure what mail_server_name should look like.

       

      Any help would be appreciated. If you have another script that does the same thing I'd love to see it.

       

      -Sam