Send Email From Processing

I am looking to send an Email from Processing. I am gathering data, and would like an easy way to send alerts when certain events happen.

It looks like this has been covered in the past but most of the resources have been deprecated. Shiffman had a pretty good one but that is not listed anymore: http://www.shiffman.net/2007/11/13/e-mail-processing/

Is this an easy thing to do? I figured it might be fairly useful and widespread.

Thank you for any tips or advice.

Tagged:

Answers

  • I found one way to do this!

    I made a AppleScript that used Mail to send an E-Mail. I then exported this as an application. Then I used launch() to launch this script.

    I made sure to quit Mail at the end of the script.

    Script Start: http://apple.stackexchange.com/questions/125822/applescript-automate-mail-tasks

    AppleScript///////////////

    set recipientName to "SomePerson"
    set recipientAddress to "Some@Email.com"
    set theSubject to "Type your subject here!"
    set theContent to "Type your message content here!"
    
    tell application "Mail"
    
        ##Create the message
        set theMessage to make new outgoing message with properties {subject:theSubject, content:theContent, visible:true}
    
        ##Set a recipient
        tell theMessage
            make new to recipient with properties {name:recipientName, address:recipientAddress}
    
            ##Send the Message
            send
    
        end tell
    
        delay 5
    
        tell application "Mail"
            quit
        end tell
    
    end tell
    

    Launch Start: https://processing.org/reference/launch_.html

    Processing////////////////

    void setup() {
      size(200, 200);
    }
    
    void draw() { 
      // draw() must be present for mousePressed() to work
    }
    
    void mousePressed() {
      println("Sending Email");
      launch("/Users/HotelZ/Documents/SendTestEmail2.app");
    }
    
Sign In or Register to comment.