Background emailing on Folder Action

I have a Folder Action Script, from MurphyMac, set up to email files dropped into the folder and it works. I would like to enhance it by

  1. setting the Subject line to be the name of the dropped file and
  2. sending the email without bringing Mail to the front
    Can someone please help me?
    Many thanks in advance.
    Best wishes
    Simon

The script so far is as follows:

(*
Murphy Mac 
see http://murphymac.com/files-mailed-magically-when-dropped-in-a-finder-folder/ for more information.
*)


on adding folder items to thefolder after receiving theAddedItems
	
	repeat with eachitem in theAddedItems
		
		
		
		
		set theSender to "Simon<simon@xxx.xx.uk>"
		set recipCommon to "Documents"
		set recipAddress to "xxxxx@xxxxxxx.com"
		set msgText to ""
		
		
		
		
		
		
		tell application "Mail"
			
			
			set newmessage to make new outgoing message with properties {subject:"Important File Attachment", content:msgText & return & return}
			tell newmessage
				set visible to true
				set sender to theSender
				
				make new to recipient with properties {name:recipCommon, address:recipAddress}
				make new attachment with properties {file name:eachitem} at after the last paragraph
				
				
			end tell
			send newmessage
		end tell
		
		
	end repeat
	
end adding folder items to

Hi,

#1 is easy:


.
set newmessage to make new outgoing message with properties {subject:"Important File Attachment: " & name of (info for eachitem), content:msgText & return & return}
.

#2 is impossible using Mail.app

Hi there,
would #2 be possible by using some other method?
Best wishes
Simon

You might be able to finagle Quicksilver to do it… I know I can send emails from within QS without mail opening… Then again, I’m an idiot when it comes to AS…

You can use XMail. There is plenty of documentation and examples
bundled with the download. Put the XMail.osax in folder => /user_name/Library/ScriptingAdditions/

http://mac.rbytes.net/cat/mac/internet-utilities/xmail/

One thing to note is that you will not have a record of the “Sent” email
like you have when using Mail.

Cheers,

Craig