tell application "Mail"
(* Change MailTasks into the name of your calendar *)
set theCalendar to "MailTasks"
set theMessages to selection
repeat with msg in theMessages
set msgsubject to subject of msg
set msgurl to "message://%3c" & (message id of msg) & "%3e"
try
tell application "iCal"
set newTodo to (make new todo at end of todos of calendar theCalendar)
tell newTodo
set summary to msgsubject
set url to msgurl
end tell
end tell
end try
end repeat
end tell