Contents of text/html Attachments

RT 4.4.3-2
When our RT instant receives emails from users, we get 3 attachments every time.

Example

696779: (Unnamed) (multipart/alternative / 0b),
696780: (Unnamed) (text/plain / 5b),
696781: (Unnamed) (text/html / 1k)

I am trying to figure out how to read the contents of only the text/html attachment in a scrip or at least would read the contents of each attachment. The code below only pulls the text/plain attachment.

Code

$self->TransactionObj->Content;

$self->TransactionObj->Attachments will return all the attachments associated with that transaction. You could then iterate through these, looking for the RT::Attachment object that matches what you want. The RT::Attachment object has a ContentType method that returns the MIME content type of that attachment, so can pull out the ones that match text/html.

Thank you, I have been working on this for the last two week. I was able to find the documentation you referenced and got it working.

1 Like