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

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

RecursiveMeta’s picture

Issue summary: View changes
DamienMcKenna’s picture

Version: 7.x-1.2 » 7.x-1.x-dev
Status: Active » Needs review
FileSize
1.11 KB

Rerolled, and tidied up a little bit.

Anonymous’s picture

Retesting.

Anonymous’s picture

Worked great for me. Terminal image included.

Chris Matthews’s picture

Status: Needs review » Reviewed & tested by the community

The 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.

spelcheck’s picture

Adding 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.

Chris Matthews’s picture

wundo’s picture

If this is still passing I'm going to commit it, thanks!

  • wundo committed 0edeaa7 on 7.x-1.x authored by DamienMcKenna
    Issue #2494339 by RecursiveMeta, DamienMcKenna, alex_drupal_dev, Chris...
wundo’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.