@@ -100,11 +100,12 @@ class Attachment(object):
100100 """A normalized EmailMessage.attachments item with additional functionality
101101
102102 Normalized to have these properties:
103- name: attachment filename; may be empty string; will be Content-ID (without <>) for inline attachments
104- content
103+ name: attachment filename; may be empty string
104+ content: bytestream
105105 mimetype: the content type; guessed if not explicit
106106 inline: bool, True if attachment has a Content-ID header
107- content_id: for inline, the Content-ID (with <>)
107+ content_id: for inline, the Content-ID (*with* <>)
108+ cid: for inline, the Content-ID *without* <>
108109 """
109110
110111 def __init__ (self , attachment , encoding ):
@@ -114,6 +115,7 @@ def __init__(self, attachment, encoding):
114115 self .encoding = encoding # should we be checking attachment["Content-Encoding"] ???
115116 self .inline = False
116117 self .content_id = None
118+ self .cid = ""
117119
118120 if isinstance (attachment , MIMEBase ):
119121 self .name = attachment .get_filename ()
@@ -123,7 +125,7 @@ def __init__(self, attachment, encoding):
123125 if attachment .get_content_maintype () == "image" and attachment ["Content-ID" ] is not None :
124126 self .inline = True
125127 self .content_id = attachment ["Content-ID" ] # including the <...>
126- self .name = self .content_id [1 :- 1 ] # without the <, >
128+ self .cid = self .content_id [1 :- 1 ] # without the <, >
127129 else :
128130 (self .name , self .content , self .mimetype ) = attachment
129131
0 commit comments