on composeMail(email_recipient, email_subject, email_content, the_file)
	
	tell application "MailMate"
        activate
        set aURL to "file:///" & the_file
        
        set sendstring to "mailto:" & email_recipient & "?subject=" & my urlencode(email_subject) & "&body="& my urlencode(email_content) &"&attachment-url=" & aURL
        
        open location sendstring with trust
	end tell
	
end composeMail


on urlencode(str)
	local str
	try
		return (do shell script "/bin/echo " & quoted form of str & ¬
        " | perl -MURI::Escape -lne 'print uri_escape($_)'")
        on error eMsg number eNum
		error "Can't urlEncode: " & eMsg number eNum
	end try
end urlEncode

