Send Mail from Script

Photoshop Script Snippets - Note: Full Scripts go in the Photoshop Scripts Forum

Moderators: xbytor, DavideBarranca, Paul MR

Paul MR

Send Mail from Script

Postby Paul MR » Sun Feb 27, 2011 11:40 am

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();
    }
}

Jeremy Knudsen

Send Mail from Script

Postby Jeremy Knudsen » Wed Dec 11, 2013 7:49 pm

I'm really curious about this script. What is the correct syntax for the "mail server" and "mail address" strings?

Mike Hale

Send Mail from Script

Postby Mike Hale » Thu Dec 12, 2013 9:34 pm

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.

Jeremy Knudsen

Send Mail from Script

Postby Jeremy Knudsen » Thu Dec 26, 2013 7:00 am

Thanks Mike! I'll check it out!


Return to “Photoshop Scripting: Code Snippets”

Who is online

Users browsing this forum: No registered users and 9 guests