Quick AppleScript Question

Discussion in 'Mac Programming' started by milaph, Dec 5, 2006.

  1. milaph macrumors newbie

    Joined:
    Dec 5, 2006
    #1
    I'm just learning AppleScript and I'm running into a really stupid problem.

    I can open a new message in Mail and get the text of the message to work and everything, but I can't seem to figure out how to get the message to send. Can someone enlighten me? I know this is probably really simple...

    Thanks in advance.
     
  2. Fearless Leader macrumors 68020

    Joined:
    Mar 21, 2006
    Location:
    Hoosiertown
    #2
    Code:
    tell application "Mail" 
        set theMessages to the selection
        repeat with thisMessage in theMessages
            display dialog "30 Boxes subject:" default answer (thisMessage's subject as string)
            set theSubject to text returned of result
            set newMessage to make new outgoing message
            tell newMessage
                set subject to theSubject
                set content to thisMessage's content
                make new to recipient with properties {address:"add@30boxes.com"}
            end tell
            send newMessage
            delete newMessage
        end repeat
    end tell
    I pulled this from a site. Im not entirely sure what your script looks like, but look at send newMessage
     
  3. Unorthodox macrumors 65816

    Unorthodox

    Joined:
    Mar 3, 2006
    Location:
    Not at the beach...
    #3
    Code:
    tell application "Mail" 
            activate
            set newMessage to make new outgoing message
            tell newMessage
                set subject to "[I][B]subject goes here[/B][/I]"
                set content to "[I][B]message subject goes here[/B][/I]"
                make new to recipient with properties {address:"[I][B]recipients_email_address@whatever.com[/B][/I]"}
            end tell
            send newMessage
    end tell
    Just replace the bold text with the proper info.
     
  4. milaph thread starter macrumors newbie

    Joined:
    Dec 5, 2006

Share This Page