Getting full source of mail in AppleMail

Does anyone know of a method to get the full source of a mail in AppleMail? Doing something like

set theSource to source of message 1 of theMailbox

doesn’t return all attachments:

Content-Transfer-Encoding: base64
Content-Disposition: attachment;
Content-Type: image/jpeg;
X-Apple-Content-Length: 573674


The Kies-Muster data should be before the last line. I could get the ID of the message and locate the missing attachments on the harddisk. But the very nice people from the fruit company unzip the attachments when necessary and then my app tries to unzip the file again. So this creates problems that I don’t want to solve at the moment.

Any ideas? Running Yosemite.

Mit freundlichen Grüßen/Regards

Trixi Willius
Mail Archiver X: The email archiving solution for professionals

I get all the attachment in the source property. But I find it easier to get the files from the disk via mail attachment:

[code]tell application “Mail”

-- Get the email
set theEmail to message 8 of mailbox 5 of inbox

-- Email details
set theId to id of theEmail
set theContent to content of theEmail
-- more details possible: subject, source, message size, sender, date received, ...

-- Get all attachments
set theAttachments to mail attachment of theEmail

-- Get the first attachment
set theFirstAttachment to item 1 of theAttachments

-- First attachment details
set theAttachmentId to id of theFirstAttachment
set theMIMEtype to MIME type of theFirstAttachment
set theFileSize to file size of theFirstAttachment
set isDownloaded to downloaded of theFirstAttachment
set theName to name of theFirstAttachment

    // I return the theName to Xojo here and get the file from the disk.

end tell[/code]

Hi Eli, thanks for the idea. The source contains the attachments from the partial emlx files. Those in the Attachments folder seem to be missing.

Unfortunately, I don’t know which attachments are in the partial emlx files and which are in the source. The class that is responsible for getting the mail text has no possibility to communicate this information to the parser. Except with a lot of refactoring.