Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
If you set the variable to convert embedded images into links (variable mimemail_linkonly), then you can't attach image files - any image files added as attachments silently disappear.
I have solved the problem for myself by adding
if ($disposition == 'attachment') $linkonly = 0;
after line 167 of mimemail.inc, so that the start of _mimemail_file now reads:
function _mimemail_file($url = NULL, $content = NULL, $name = '', $type = '', $disposition = 'inline') {
static $files = array();
static $ids = array();
if ($url) {
$image = preg_match('!\.(png|gif|jpg|jpeg)$!i', $url);
$linkonly = variable_get('mimemail_linkonly', 0);
if ($disposition == 'attachment') $linkonly = 0;
// The file exists on the server as-is. Allows for non-web-accessible files.
I am not aware of the wider ramifications of that change.
Comments
Comment #1
ogursoy CreditAttribution: ogursoy commentedBug and the solution above confirmed.
Comment #2
TR CreditAttribution: TR commentedComment #3
TR CreditAttribution: TR commentedSee also the discussion in #2183955: Private File System and image not being embedded - Could someone advice me. comments #19, #20, #21, #22, and #23, where this issue was raised and a fix similar to the above was also provided.
This issue needs a PATCH and a TEST that demonstrates the bug and proves the fix.