Skip navigation

Solving AppleScript Error with Lion Mail in forwarding email

5983 Views 18 Replies Latest reply: Oct 18, 2012 10:13 AM by rslatkin RSS
  • kae Level 1 Level 1 (105 points)

    I found out one thing.  I commented out the line:


    (* set visible to false *)


    It appears that the default is to not make the window visible.  So, instead of setting visible to false or even setting it to true, I just don't set it and the new mail window doesn't show up.


    See if that works in yours too.

  • oba Calculating status...

    I know this is an old thread but I wanted to modify this a bit to work better with my mobile devices and my IMAP mail setup.


    Each of my IMAP accounts has it's own Spam folder and on my iPhone I can simply move junk mail to the Spam folder and the same happens across all of my devices.


    So my plan is to schedule this script once a day to take all of the messages in my various Spam folders and forward them on as the original script does.


    This is what I have so far:


    tell application "Mail"

      set everyIMAPAccount to every imap account

      repeat with eachIMAPAccount in everyIMAPAccount

        tell eachIMAPAccount

          set theMessages to messages in mailbox "INBOX/Spam" of eachIMAPAccount

          repeat with thisMessage in theMessages

            set newMessage to make new outgoing message at end of outgoing messages

            tell newMessage

              set content to get thisMessage's source

              set subject to thisMessage's subject

              make new to recipient with properties {address:""}

            end tell

            send newMessage

            delete thisMessage

          end repeat

        end tell

      end repeat

    end tell

    So this is my problem, when the outgoing message is created I get a 1728 error saying, "Can’t get every outgoing message of account \"*myaccount*\"." number -1728 from every outgoing message of account "*myaccount*""


    I'm assuming it is because I'm in the folder structure of a specific IMAP account which does not contain the outbox. So I need to set my outgoing message to the end of the outgoing messages of my top level outbox but I don't know how to do that.


    I'm stumped. Does anyone have any suggestions?



    Message was edited by: oba (cleaned up formatting of code)

  • rslatkin Calculating status...

    I'm having the same applescript error whenever I try to get the messages from an IMAP folder, no matter which one I try. Does anyone know how to fix this?

1 2 Previous Next


More Like This

  • Retrieving data ...

Bookmarked By (0)


  • This solved my question - 10 points
  • This helped me - 5 points
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.