• 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
help with mail.app please
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

help with mail.app please


  • Subject: help with mail.app please
  • From: Warren Pollans <email@hidden>
  • Date: Wed, 22 Sep 2004 11:09:36 -0400

Hello,

I'm using 10.2.8 and would like some help/direction with what should be basic mail.app scripting. I want a rule to send each incoming mail message through a shell script that runs clanscan (virus checker) and returns status - If the status is not zero, I want the mesg moved to mailbox "Quarantine".

I'm trying to save each mail to a file and pass the file to clamscan. My first problem is that "theMailFile" is not being written. I know I'm getting each mesg because I can "display dialog theContent" but I'm not sure if the "content" is what I want - I would like to be able to get the contents, including attachments, of the mesg. My attempt at doing this is below - I don't know what I'm doing here - obvious yes? :-)

Could someone please direct me to some "applescripting mail.app" info.

Thanks,

Warren

+++++++++++++++++++++++++++++++

on perform_mail_action(info)
	tell application "Mail"
		set selectedMessages to |SelectedMessages| of info
		set theMailFile to "/tmp/thismailmsg"
		repeat with eachMessage in selectedMessages
			set theContent to content of eachMessage
			save theContent in theMailFile
			set theCommand to "/usr/local/bin/clamscan --quiet " & theMailFile
			set spamStatus to do shell script theCommand
			if (spamStatus > 0) then
				set mailbox of eachMessage to mailbox "Quarantine"
			end if
		end repeat
	end tell
end perform_mail_action

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • [SOLUTION] help with mail.app please
      • From: Warren Pollans <email@hidden>
  • Prev by Date: Re: specifying a new file (without "choose file name...")?
  • Next by Date: Re: Change type/creator
  • Previous by thread: Re: Scripting Console
  • Next by thread: [SOLUTION] help with mail.app please
  • Index(es):
    • Date
    • Thread