• 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
Re: Send selected messages as attachments in Mail.app
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Send selected messages as attachments in Mail.app


  • Subject: Re: Send selected messages as attachments in Mail.app
  • From: Le Stang Jean-Baptiste <email@hidden>
  • Date: Sat, 9 Dec 2006 10:39:16 +0100

Hello,

The following script will take every selected messages and attach them to a new mail message, you can of course replace the use of 'send mail' (this verb comes with the XMail osax, http://lestang.org/ osax/XMail) by a piece of script that will create a mail message in Mail and then add attachments to it but XMail makes things more compact :p

set theList to get selected messages of first message viewer
set theFileList to {}
repeat with x in theList
	set myFile to (POSIX file (do shell script "mktemp -t mail"))
	set myFileFp to open for access myFile with write permission
	write (get source of x) to myFileFp
	close access myFileFp
	set end of theFileList to myFile
end repeat

send mail to "email@hidden" from "email@hidden" subject "my test" body "my message" attachments theFileList SMTP server "localhost"


On Dec 8, 2006, at 4:49 PM, Justin wrote:

Hi folks!

Our mail server has two "spam" and "ham" training email addresses to which
mail can be sent as attachments, but that is the only way the training will
work -- the entire source of the message must be included as an attached
text file to the message (the body/subject/etc of the message itself is
ignored). This is great for our Entourage users, as they can simply select
multiple messages and use the "Forward as Attachment" option. Our Mail.app
users are less fortunate, however; try as I might, I cannot seem to come up
with an automated way to forward selected messages as attachments in Apple
Mail.


My attempts in Automator would come close but were ultimately fruitless. I
imagine that this should be possible via AppleScript, but thus far I have
been unsuccessful in my attempts. Might anyone out there have any
suggestions?


Other bits:

* The destination email address is fixed.
* It would be nice to be able to select multiple messages, right click on
the selection, and choose "Forward as Attachment." A keyboard shortcut
would do the trick as well.


Any pointers or code snippets would be most sincerely appreciated. Thank
you! :)


Best,

Justin


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


This email sent to email@hidden


_______________________________________________ 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/mailman//archives/applescript-users

This email sent to email@hidden
  • Follow-Ups:
    • Re: Send selected messages as attachments in Mail.app
      • From: Justin <email@hidden>
References: 
 >Send selected messages as attachments in Mail.app (From: Justin <email@hidden>)

  • Prev by Date: Re: Script a QuickTime Player Movie Recording
  • Next by Date: AS and Startup Items
  • Previous by thread: Send selected messages as attachments in Mail.app
  • Next by thread: Re: Send selected messages as attachments in Mail.app
  • Index(es):
    • Date
    • Thread