Applescript to save email messages feasible?

Can someone tell me if this is feasible? If it is I might try and learn Applescript to write it.
At work we have a problem trying to get people to file emails correctly. We want each email to be saved to their respective project folders on the server as RTFs (or ODFs).
So I'm wondering if the following Applescript is feasible?
1) Open a read email, normal behaviour would ensue
2) Open an unread email and a separate dialogue window pops up, prompting the user to choose a filename and somewhere to save the message (this should include the ability to choose a filename by clicking on existing files, as in a normal save dialogue).
3) If the email has attachments the same pop-up window, or a separate one, would prompt the user to choose a (possibly different) folder to save the attachments, and allow the user to choose which attachments to save, including none.
4) Lastly the the same pop-up window, or a separate one, would prompt the user for a folder within Mail to move the message to.

A native AppleScript possibility, - although, not via a single window
With respect to '2) Open an unread email ...' - one could create a 'Rule' in 'Mail' to execute an AppleScript script.
The AppleScript script would open each e-Mail message, present a 'choose folder' dialog box (consult 'Library' windows' 'StandardAdditions.osax' dictionary), followed by a 'display dialog' (with a 'default answer ""' entry) for file name entry, The information from the two (2) dialog box'es would be concatenated to form a new file path.
With respect to '3) If the email has attachments ...' - the list of attachments, of each e-Mail message, would be looped (repeat ... end repeat) through - with a 'choose folder' dialog displayed as the destination of the attachment. Naturally, if the attachments' name is to be user editable - a display dialog (with a 'default answer '""' entry) would be required. Again, the information from the two (2) dialog box'es would be concatenated to form a new file path.
Finally, with respect to '4) ... prompt the user for a folder within Mail to move the message to.' is possible by a 'choose from list' dialog box; where the list is of the 'Mailbox' names of 'Mail'.

Similar Messages

  • Can no longer save email messages to my files

    Before upgrading to Mavericks, I could open an email message from a client, click Save As, select a folder, then save the message as a text file to the appropriate folder on my hard drive. It seems I can no longer do that. I always get a Mail error message saying "Names longer than 31 characters are not supported on the destination volume."(Even when the name is already shorter than that, I go through the exercise of shortening it.) After doing that, I click Save. Then I get an error saying "Error: Could not save to path...." which, incidentally, goes haywire part of the way through and takes it down a path that is a completely wrong folder for another client. Regardless, it doesn't save.
    I've tried completely renaming the file. I've tried everything I can think of.
    This used to be SO SIMPLE:  Just click Save As, select the appropriate folder, then click Save.
    In Mavericks, do I need to convert this email message into a Word document in order to save it to a folder?

    Please follow these directions to delete the Mail "sandbox" folders. In OS X 10.9 there are two sandboxes, while in 10.8 there is only one. If you're running a version older than 10.8, this comment isn't applicable.
    Back up all data.
    Triple-click anywhere in the line below on this page to select it:
    ~/Library/Containers/com.apple.mail
    Right-click or control-click the highlighted line and select
              Services ▹ Reveal
    from the contextual menu.* A Finder window should open with a folder named "com.apple.mail" selected. If it does, move the selected folder—not just its contents—to the Desktop. Leave the Finder window open for now.
    Log out and log back in. Launch Mail and test. If the problem is resolved, you may have to recreate some of your Mail settings. You can then delete the folder you moved and close the Finder window.
    This action will delete any custom Mail stationery that you have created. If you want to preserve it, ask for instructions.
    If you still have the problem, quit Mail again and put the folder back where it was, overwriting the one that may have been created in its place. Repeat with this line:
    ~/Library/Containers/com.apple.MailServiceAgent
    Caution: If you change any of the contents of the sandbox, but leave the folder itself in place, Mail may crash or not launch at all. Deleting the whole sandbox will cause it to be rebuilt automatically.
    *If you don't see the contextual menu item, copy the selected text to the Clipboard by pressing the key combination  command-C. In the Finder, select
              Go ▹ Go to Folder...
    from the menu bar and paste into the box that opens by pressing command-V. You won't see what you pasted because a line break is included. Press return.

  • Mail crash when trying to save email message

    I installed OS10.5.1 recently and yesterday mail starting crashing whenever I'd try to save an email message ("save as" or shift apple s). Based on one post, I ran a verify and repair disk permissions (from the hard drive, not from the startup disk) but no remedy. The beginning of the crash reports reads: Process: Mail [150]
    Path: /Applications/Mail.app/Contents/MacOS/Mail
    Identifier: com.apple.mail
    Version: 3.1 (914)
    Build Info: Mail-9140000~1
    Code Type: PPC (Native)
    Parent Process: launchd [85]
    Date/Time: 2008-01-18 08:36:00.182 -0600
    OS Version: Mac OS X 10.5.1 (9B18)
    Report Version: 6
    Exception Type: EXCBADACCESS (SIGSEGV)
    Exception Codes: KERNPROTECTIONFAILURE at 0x00000000bf7fffe0
    Crashed Thread: 0
    Any ideas on how to repair this would be appreciated. Thanks.

    Hi Farid Shahin.
    Verify/repair the startup disk (not just permissions), as described in the following article, in case there is something amiss in the filesystem:
    The Repair functions of Disk Utility: what's it all about?
    You’d get better results using Eudora Mailbox Cleaner to do the conversion.
    Eudora Mailbox Cleaner requires rebuilding the imported mailboxes in Mail afterwards. Instead of rebuilding them one by one, you can re-create the entire index as follows:
    1. Quit Mail if it’s running.
    2. In the Finder, go to ~/Library/Mail/. Make a backup copy of this folder, just in case something goes wrong, e.g. by dragging it to the Desktop while holding the Option (Alt) key down. This is where all your mail is locally stored.
    3. Locate Envelope Index and move it to the Trash. If you see any other “Envelope Index”-named file there, delete it as well.
    4. Open Mail. It will tell you that your mail needs to be “imported”. Click Continue and Mail will proceed to re-create Envelope Index — Mail says it’s “importing”, but it just re-creates the index if the mailboxes are already in Mail 2.x format.
    Note: For those not familiarized with the ~/ notation, it refers to the user’s home folder. That is, ~/Library is the Library folder within the user’s home folder, i.e. /Users/username/Library.

  • Save email message in db

    I try to save content of email in db,
    Message msContent=message.getContent();
    after
    java.io.InputStream mesAsInputStream=(InputStream)msContent;
    But I receive exception Exception in thread "main" java.lang.ClassCastException: java.lang.String cannot be cast to java.io.InputStream
    I understand that there are 2 types of messages first one a simple string, and second a multipart.
    But I would like save as object in db indipendent from type of message.
    But for save in db it need cast to InputStream. Could you please me say how it can be done correct?

    Hi,
    The Message is an interface which extends another interface which is Part interface. Now the implementation of the Message ( the class implementation ) is not an InputStream
    The best thing to do is to serialize the object as a stream of bytes and save it into the database as blob datatype
    or you can send it into the ByteArrayOutputStream and convert the byte stream to string using a characterset which is pretty standard which you may change if you are using different characterset
    public static void printToStream(Message m) throws IOException, MessagingException {
              ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
              m.writeTo(outputStream);
              String message = outputStream.toString("UTF-8"); // character encoding set
              // now save the message into the database
         }Regards.
    Alan Mehio
    London, UK

  • Osx mavericks - cant move or save email messages

    In all the older operating systems it would allow a user to drag an email message from Mail to anywhere you wanted to stash it; the desktop or any folder. Now with Mavericks it won't allow any moving or saving of an email message outside of the Mail apps internal folders.

    I restarted the iMac and now it seems to allow this operation - so I consider this problem resolved for now.

  • Using AppleScript to save Mail messages?

    I'm a bit of an Applescript newbie, but I'm trying to attach an AppleScript to a rule in Mail to automatically save the raw text source of certain mail messages to a folder, where I can further process them.
    Here's what I have so far. It compiles, is saved in my Mail scripts folder, and It is attached to the rule in Mail, but I get no evidence that it runs (no output file(s), no dialogs, no messages in the console or system logs).
    using terms from application "Mail"
    on perform mail action with messages theMessages
    tell application "Mail"
    repeat with eachMessage in theMessages
    save the source of eachMessage in "hd/Users/me/Desktop/slash.txt" as text
    save the source of eachMessage in "hd:Users:me:Desktop:colon.txt" as text
    end repeat
    end tell
    end perform mail action with messages
    end using terms from
    Any suggestions?
    G4 "Gigabit" Dual-500   Mac OS X (10.4.8)   1.5GB RAM, 1TB internal, SCSI, 802.11g, USB2.0

    Hi 0g,
    Automator is pretty simple compared to AppleScript. I use Automator, but I certainly could not help you with AppleScript! So I'm not sure you will find your answer here... You might, but why don't you increase your chances by posting in the AppleScript Forum here: http://discussions.apple.com/forum.jspa?forumID=724
    (You probably didn't see that one as it is hidden in the Mac OS X Technologies Category!)
    Good luck!
    Guylaine
    Mac mini Intel Core Duo 1.66 GHz 512MB DDR2 SDRAM Mac OS X (10.4.8) G4 Digital Audio Mac OS 9.2.2, iPod nano 1GB, iPod nano 4GB

  • Saving email message to a file

    I was trying to save email messages (not just message text, but everything) into a file. But I got exception stating that com.sun.mail.pop3.POP3Message is not serializable. Is there any workaround to save email object into a file?

    This writes the message as an object to a file.
    It is fully functional - use this in one of my programs.
    try{
    email = (MimeMessage)message;
    file=new File(fileName);
    outFile=new FileOutputStream(file);
    outStream=new ObjectOutputStream(outFile);
    e.writeTo(outStream);
    closeStream();
    outStream.close();
    outFile.close();
    catch(Exception ex)
    {/error writing file}
    Good Luck!
    jared

  • Saving email messages

    On my iPad my mail service is via a POP account. I understand that I cannot add any additional mailboxes to the Mail app.
    Is there a way to save email messages somewhere else besides the Inbox?
    Thanks, Jim

    https://itunes.apple.com/us/app/altamail/id328890658?mt=8
    This app will allow you to do what you are wanting to do.
    BEST app on the app store for email BAR NONE
    The press are convinced!
    ========================
    Incredible iPhone Apps for Dummies "The more e-mail you send & receive on your iPhone/iPad, the more you'll appreciate AltaMail "
    AppShouter: "this app exp&s the possibilities for mail"
    iPhone Apps Finder: "a very solid business app - 9/10"
    ArticleClick: "....bottom line is that this app exp&s the possibilities for mail on your iPhone or iPad"
    I use it and LOVE it. Wish I had created it lol
    the one I made only archives better than the stock apple app but eh this is the Best so why try reinventing the wheel =)

  • How can i leave a copy of email message after receiving it on outlook, how can i leave a copy of email message after receiving it on outlook

    i have a problem that i cant save email message on both my iphone and on outlook on pc

    So even though he can see everything he's ever gotten in All Mail, he still wants in in Inbox?  I realize the how to do it is a little bit of a stumper and it shouldn't be so difficult... but honestly, I think the more relevant question would be Why? Why would anyone in their right mind want to do that?
    How does his Blackberry currently access his Gmail account? It should be a simple matter to duplicate the settings. It's undoubtedly just using POP and not deleting the originals as they are downloaded.
    Here's what's going to happen if that's the case. The very first time he sets up a new device... phone, pc, doesn't matter, to use POP, it's going to download every e-mail he's ever gotten unless he goes in and tells Gmail otherwise.

  • AppleScript To Save Messages As PDFs With Specific Naming Convention

    I am looking for an Applescript that:
    1: Prompts and allows the user to select one or more Apple Mail email messages from within Mail (10.4, 10.5, 10.6).
    2: Prompts and allows the user to select a save-to folder.
    3: For each message, saves it as a PDF file in the save-to folder, using the following naming convention for the PDF file:
    "YYYY-MM-DD HH.MM.SS Email From FIRSTNAME LASTNAME - SUBJECT",
    "YYYY-MM-DD HH.MM.SS Email To FIRSTNAME LASTNAME - SUBJECT",
    where in the email date-sent stamp (if I am the sender) or date-received stamp (if I am the recipient):
    YYYY = the year
    MM = the two-digit month
    DD = the two-digit day
    HH = the two-digit hour (in 24-hour time)
    MM = the two-digit minute
    SS = the two-digit second
    FIRSTNAME is the email sender's first name for email that I receive (or is the email recipient's first name for email that I send)
    LASTNAME is the email sender's last name for email that I receive (or is the email recipient's first name for email that I send)
    SUBJECT = the email's subject line
    For example: 2010-04-10 16.32.48 Email From Kris Ryan - Status Of Payroll Updates.pdf
    For example: 2010-04-10 16.33.55 Email To Sue Anderson - RE Status Of Payroll Updates.pdf (Colon omitted after "RE".)
    4: For each attachment to the message, saves it as a PDF file in the same directory using the naming convention:
    "YYYY-MM-DD HH.MM.SS Email From FIRSTNAME LASTNAME Z Attachment - NUMBER - FILENAME",
    where:
    YYYY-MM-DD HH.MM.SS Email From FIRSTNAME LASTNAME = as above
    NUMBER = an integer representing the attachment number (1, 2, ...) sorted according to filename alphabetical order
    FILENAME = the name of the file attached to the email, including its extension (.docx, .xlsx, etc.)
    The letter "Z" sorts the attachment PDFs after its respective parent email in the directory.
    For example: 2010-04-10 16.32.48 Email From Kris Ryan Z Attachment - 1 - List Of Suggestions To Moore.doc.pdf
    For example: 2010-04-10 16.32.48 Email From Kris Ryan Z Attachment - 2 - Proposed Salary Adjustments.xls.pdf
    For example: 2010-04-10 16.32.48 Email From Kris Ryan Z Attachment - 3 - Salary History.pps.pdf
    Note: The email attachment may consist of a PDF or MS Office file (Word, Excel, Power Point); however, a smart implementation will be able to handle any attachment kind. If the attachment is a PDF file, then save it "as is" using the stipulated naming convention, without passing it through Distiller.
    Thank you.
    Kurt Todoroff

    Well, that's quite a spec sheet.
    Here's a start, you can easily edit the script to get what you need:
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    font-weight: normal;
    margin: 0px;
    padding: 5px;
    border: 1px solid #000000;
    width: 720px; height: 340px;
    color: #000000;
    background-color: #E6E6EE;
    overflow: auto;"
    title="this text can be pasted into the AppleScript Editor">
    Set a Mail Rule to Save Message and Attachment to Desktop.
    To save attachments to another another folder on the desktop (i.e. Attachments) create the folder and then
    change tell application "Finder" to set pathToAttachments to (path to desktop folder as string) & "Attachments:"
    using terms from application "Mail"
    on perform mail action with messages theMessages
    tell application "Finder" to set ptd to (path to desktop folder) as string
    tell application "Finder" to set pathToAttachments to (path to desktop folder) as string
    tell application "Mail"
    repeat with theMessage in theMessages
    set d_recd to date received of theMessage as string
    set d_recd to ReplaceText(d_recd, ":", " ") of me
    set d_recd to ReplaceText(d_recd, ",", " ") of me
    set theText to content of theMessage
    if theMessage's mail attachments is not {} then
    repeat with theAttachment in theMessage's mail attachments
    set theFileName to pathToAttachments & (theMessage's subject) & " (Attachment From " & (theMessage's sender) & " Sent " & d_recd & ")" & space & theAttachment's name
    try
    save theAttachment in theFileName
    on error errnum
    end try
    end repeat
    end if
    set theFile to ptd & (theMessage's subject) & " (From " & (theMessage's sender) & " Sent " & d_recd & ")" & ".txt"
    set theFileID to open for access file theFile with write permission
    write theText to theFileID
    close access theFileID
    end repeat
    end tell
    end perform mail action with messages
    end using terms from
    on ReplaceText(theString, fString, rString)
    set current_Delimiters to text item delimiters of AppleScript
    set AppleScript's text item delimiters to fString
    set sList to every text item of theString
    set AppleScript's text item delimiters to rString
    set newString to sList as string
    set AppleScript's text item delimiters to current_Delimiters
    return newString
    end ReplaceText</pre>

  • AppleScript save email to pdf file issues

    HI,
    1. Can I use AppleScript save Apple mail message to pdf file, I mean not using GUI script.
    2. If possible for point 1, can it save the email message to network folder?
    Thanks in advance.
    patrick

    Please read this whole message before doing anything.
    This procedure is a diagnostic test. It’s unlikely to solve your problem. Don’t be disappointed when you find that nothing has changed after you complete it.
    The purpose of the test is to determine whether your problem is caused by third-party system modifications that load automatically at startup or login. 
    Disconnect all wired peripherals except those needed for the test, and remove all aftermarket expansion cards. Boot in safe mode* and log in to the account with the problem. The instructions provided by Apple are as follows:
    Shut down your computer, wait 30 seconds, and then hold down the shift key while pressing the power button.
    When you see the gray Apple logo, release the shift key.
    If you are prompted to log in, type your password, and then hold down the shift key again as you click  Log in.
    *Note: If FileVault is enabled under OS X 10.7 or later, or if a firmware password is set, or if the boot volume is a software RAID, you can’t boot in safe mode. Safe mode is much slower to boot and run than normal, and some things won’t work at all, including wireless networking on certain Macs.  The next normal boot may also be somewhat slow.
    The login screen appears even if you usually log in automatically. You must know your login password in order to log in. If you’ve forgotten the password, you will need to reset it before you begin. Test while in safe mode. Same problem? After testing, reboot as usual (i.e., not in safe mode) and verify that you still have the problem. Post the results of the test.

  • In an eMail message, when I attempt to save two photos by clicking the 'Save 2 Images' link, not the 'Save Image' link, the images are not saved. (I use I I apologize for the late notice, butOS7 on IPhone5). Is this feature broken?

    In an eMail message, when I attempt to save two photos by clicking the 'Save 2 Images' link, not the 'Save Image' link, the images are not saved. (I use I I apologize for the late notice, butOS7 on IPhone5). Is this feature broken?

    Please don't post the same question multiple times!

  • Error Message  when trying to "Save Email as Activity" on Outlook 2007

    Hi all,
    This is a problem that we have logged with SAP, but they cannot find any reasons as to why we are having the problem. So I'm hoping someone here might be able to shed some light...
    After logging onto SAP through Outlook:
    When "Saving an email as Activity" using the Outlook ADDON, we get the following error message:
    AppName: bo_syncext.exe      AppVer: 8.0.0.49      ModName: bo_syncext.exe
    ModVer: 8.0.0.49      Offset: 000cc9d5
    This does not seem to work on any of our computers, except one!
    He is a Superuser, and he can save emails on his PC only.
    I can also save the emails, if I am logged on his computer, and am set up as a Superuser. I cannot if I am not a Superuser.
    He and I cannot send emails as a Superuser on my PC.
    This would lead me to think that it is a problem with our PC settings (security settings?).
    Has anyone else had this problem?
    Outlook version: 2007 (12.0.6514.5000) SP2 MSO (12.0.6425.1000)
    SAP Business One 2007.
    Many thanks
    Shaoni

    Hi
    I also have the same issue.
    I can save an email as an activity for only one user, this user is a super user.
    If i log on to that users machine as them, then sap as a user with the issue change them to a super user it works.
    However logged on to any other machine it won't work. We get the error message ;-
    Outlook itegration - error signature - AppName bo_syncext.exe, AppVer 8.0.0.49  Mod Name ntdll.dll ModVer 5.1.2600.3520
    Has anyone fixed this on a system ???

  • I am in New Zealand and when I type up a rather long email to send back home, the send button does not light up by the time I finish and I cannot send the email and can't seem to save the message or anything and then as soon as I touch a button, poof, gon

    Can anyone tell me why when I type a very long email, the send button is not highlighted anymore when I am done and I can't send the message? And I can't seem to save the message or anything and as soon as I touch a button, I lose the whole thing. Any suggestions?

    Have you tried typing and saving using Notes or word processing Apps before sending message?

  • How can I delete an attachment from a received email but save the message?

    Hi all, how can I delete an attachment from a received email but save the message?*

    Over the years this issue crops up again and again. Here are the cases I know about:
    Case 1 - it simply doesn't work
    I have a message in my inbox with a jpeg of about 300Mb. Select message, choose option "remove attachment" which is not greyed out, and it does not work.
    Case 2 - it works if you save the message first
    I move the message from the inbox to a mail box. Open the mailbox (select), select the message, choose option "remove attachment", result: the attachment is removed, a small text file is added and an error appears in the message "missing plug-in". The message size is reduced from 300Mb to a few bytes.
    Case 3 - the option "remove attachment" is greyed out.
    I've googled this at least 10 times and read all the advice about editing various files from the library and all the other hacks. The simple truth here is that the user should not be inconvenienced by such inappropriate behaviour. We're not used to this from Apple any more, not since OS X. Even Windows does this stuff painlessly. In fact this kind of function is something that Outlook and Exchange do incredibly well. If they didn't the corporate world would have ground to a halt.
    My point: the remove attachment option should work all the time and should be redesigned. Right-click + save as + delete in the message would be a hundred times easier.

Maybe you are looking for

  • How to update from pre App Store versions of iPhoto to iPhoto 9.6.1

    After updating to Yosemite 10.3.3 from Mavericks my old iPhoto '08 v7.1.5(378) copy of iPhoto is grayed out with the circle/bar through it. I can use Old Toads package contents workaround to run it; but would like to not have to use that workaround e

  • Stange Files getting Created

    I have recently noticed that I am getting strange files that I am not sure were they are coming from. The files when opened using VI show the text of MUTX and that is all they say. They are names starting with 0x, followed by a rather long string of

  • Error in start conditions

    Hi experts, I Get an error in my application monitors, we dont have any clue who is the user and why is he facing such error. Can any one help me out in this regard. The error is Start conditions for 00050101442 is incorrect : 0 workflows This is SRM

  • Rebel d1000. 55/85mm zoom lens.washed out color

    no manual or software.all functions are fine but very dissapionted with color rendition After exhausting exposure,format,white balance fine tunning,color space,picture styles,lighting,tripod, small f stops and gray card tests i'm out of ideas.i canno

  • HT201541 My website has stopped working in Safari Version 5.1.10?

    My website (www.dollshousefireplace.co.uk) has stopped working in Safari Version 5.1.10 (old Mac pro) and on one of my other machines (old imac) running Version 5.0.6? but it works fine on other devices (ipad, iphone, (new) Mac pro and PC) using (pro