Convert mail raw source into string

Hi everyone,

since weeks I am getting a lot of spam via email, these emails are all different but what they have in common is a hyperlink. Since Apple mail doesn't allow you to create a rule based on raw source but only on body content, I am trying to create a rule that copies the entire message, convert it to string, check if a specific string is in it and then deletes the message.

my entire script is ready but I am having difficulties on converting "theMessage" into string, I guess that the html code is somehow sending AppleScript crazy.

Do you have any suggestion?

Answered by Barlotta in 695563022

Found it, if someone will ever need that:

set theBody to the source of theMessage as string

If you share the error message and the AppleScript code, someone may be able to assist you.

Accepted Answer

Found it, if someone will ever need that:

set theBody to the source of theMessage as string

Convert mail raw source into string
 
 
Q