importgroupdocs.watermarkasgwimportgroupdocs.watermark.contents.emailasgwc_emailload_options=gw.EmailLoadOptions()withgw.Watermarker("message.msg",load_options)aswatermarker:content=watermarker.get_content(gwc_email.EmailContent)content.body="Test plain text body"content.html_body="<html><body>Test html body</body></html>"content.subject="Test subject"watermarker.save("message.msg")
Embedding image to email message body
importgroupdocs.watermarkasgwimportgroupdocs.watermark.contents.emailasgwc_emailload_options=gw.EmailLoadOptions()withgw.Watermarker("message.msg",load_options)aswatermarker:content=watermarker.get_content(gwc_email.EmailContent)withopen("sample.jpg","rb")asf:content.embedded_objects.add(f.read(),"sample.jpg")embedded_object=content.embedded_objects[content.embedded_objects.count-1]content.html_body=f"<html><body>This is an embedded image: <img src=\"cid:{embedded_object.content_id}\"></body></html>"watermarker.save("message.msg")
Removing all embedded images from email message body