Skip to content

Support for attachment content ID #7

@jiange2

Description

@jiange2

When an email contains embedded images, its HTML will include elements like:

<img style="max-width: 1139px;" size="297420" data-outlook-trace="F:1|T:1" src="cid:2b864420-1564-402e-a351-1e48597f4fbe">

Here, the src attribute uses the format ‘cid:’.

Currently, the attachment object in python-oxmsg does not return the content ID, which makes it impossible to associate the cid in the HTML with the corresponding attachment.

It is hoped that the attachment object can return the content ID, with a modification similar to the following:


 class Attachment:

    @lazyproperty
    def cid(self) -> str | None:
        """The content id of this file.
    
        Like "2b864420-1564-402e-a351-1e48597f4fbe".
        """
        return self.properties.str_prop_value(c.PID_ATTACH_CONTENT_ID)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions