Problem/Motivation
As a module developer, I wanted to use inline image embeds e.g. <img src="cid:xxx.jpg">
and attach an image with the Content Id property. PHPMailer supports this with the function AddEmbeddedImage. I did not find a way to do this with the code. I wrote a patch and I will include it. If this is already been included in smtp, please disregard.
I had a need to attach images from the private file system due due to the system being a secured site. If there is a better way to do this let me know.
Proposed resolution
The solution I am proposing is to have smtp mail code test for the existance of an 'images' properties in the parameter array. If the array key exists and there are image attachment arrays as keys. Iterate through the keys and include images in the email via the PHPMailer object function AddEmbeddedImage
Content Ids
https://tools.ietf.org/html/rfc2392
Comment | File | Size | Author |
---|---|---|---|
#4 | Screen shot 2016-01-30 at 10.47.15 PM.png | 37.19 KB | Anonymous (not verified) |
#2 | smtp-n2494339-2.patch | 1.11 KB | DamienMcKenna |
Comments
Comment #1
RecursiveMeta CreditAttribution: RecursiveMeta commentedComment #2
DamienMcKennaRerolled, and tidied up a little bit.
Comment #3
Anonymous (not verified) CreditAttribution: Anonymous as a volunteer and commentedRetesting.
Comment #4
Anonymous (not verified) CreditAttribution: Anonymous as a volunteer and commentedWorked great for me. Terminal image included.
Comment #5
Chris Matthews CreditAttribution: Chris Matthews commentedThe 3 year old patch in #2 still applies cleanly to the latest 7.x-1.x dev snapshot and seems straight forward to me so I'm changing the status to RTBC.
Comment #6
spelcheck CreditAttribution: spelcheck as a volunteer commentedAdding related
1813164: Mime Mail -> SMTP with embedded images
in case anyone wants embedded image functionality while using Mail Mime or Mime Mail ahead of SMTP.https://www.drupal.org/project/smtp/issues/1813164
Additionally the patch in the above issue adds admin configuration options to enable or disable the auto-embedding of images, additional logic to handle incoming processed emails from both HTML Mail and Mime Mail, and checks to ensure the image is locally hosted before embedding it (to mitigate abuse). Though the patch in this issue is RTBC, it's worth looking at the patch in the above link before committing it.
Comment #7
Chris Matthews CreditAttribution: Chris Matthews commentedComment #8
wundo CreditAttribution: wundo at Chuva Inc. commentedIf this is still passing I'm going to commit it, thanks!
Comment #10
wundo CreditAttribution: wundo at Chuva Inc. commented