Page 1 of 1

Send Mail from Script

Posted: Sun Feb 27, 2011 11:40 am
by Paul MR
Code: Select allvar 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();
    }
}

Send Mail from Script

Posted: Wed Dec 11, 2013 7:49 pm
by Jeremy Knudsen
I'm really curious about this script. What is the correct syntax for the "mail server" and "mail address" strings?

Send Mail from Script

Posted: Thu Dec 12, 2013 9:34 pm
by Mike Hale
You might want to check out the EMailer panel on Russell Brown's web site. It handles the back end email details and has an option to resize before emailing.

Send Mail from Script

Posted: Thu Dec 26, 2013 7:00 am
by Jeremy Knudsen
Thanks Mike! I'll check it out!