• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Saving mail attachments...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Saving mail attachments...


  • Subject: Saving mail attachments...
  • From: Jean-Christophe Helary <email@hidden>
  • Date: Thu, 10 Mar 2011 14:43:13 +0900

Thanks to all the comments I got onlist and offlist I made a huge lot of progress.

Now I have a little problem saving attachments to mails that only reveal attachments when the View > Message > option is set to whatever alternative is not "text" (it is not explicit in the menu options).

The mailbox listing shows that the mail has a number of attachments but when the mail opens in the default view, I get only a plain text view of its contents and nothing attached.

When I change the view option, then I get the attachments.


For most mails, I'd automatically see the attachments in the mail it is default view.

In any case, the script I wrote recognizes attachments when they are displayed in default view but not when they are displayed after I changed the view. I guess it comes from my asking the script to save attachments from the selected mail and not from the displayed/open mail...

Here is the relevant (trivial) part of my script:

	tell application "Mail"
		set job to item 1 of (get selection)
		set job_info to (get source of job)
		set job_name to ((get subject of job as text) & ".eml")
		set job_path to open for access file ((project_folders as text) & "informations:" & job_name) with write permission
		write job_info to job_path
		close access job_path
		repeat with original in every mail attachment in job
			set original_name to (get name of original)
			tell original
				set original_path to POSIX path of ((project_folders as text) & "originaux:" & original_name)
				save original in (POSIX file original_path)
			end tell
		end repeat
	end tell

Obviously, if Mail does not detect an attachment then there is going to be a problem... What would be the method to force it to interpret the mail as not plain text (which it seems to do...)

Any idea ?


Jean-Christophe Helary
----------------------------------------
fun: http://mac4translators.blogspot.com
work: http://www.doublet.jp (ja/en > fr)
tweets: http://twitter.com/brandelune

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Saving mail attachments...
      • From: Luther Fuller <email@hidden>
  • Prev by Date: Re: Rant Generator
  • Next by Date: Re: Saving mail attachments...
  • Previous by thread: how do i get all (iCal) events for a specified date via applescript
  • Next by thread: Re: Saving mail attachments...
  • Index(es):
    • Date
    • Thread