1
0
mirror of https://github.com/axllent/mailpit.git synced 2025-03-17 21:18:19 +02:00

UI: Support for inline images using filenames instead of cid

Some historic email programs use the attachment filename instead of a reference cid for inline images (eg: Outlook).
This commit is contained in:
Ralph Slooten 2022-09-16 18:40:29 +12:00
parent 997e041042
commit 5d6aa7c48a

View File

@ -173,6 +173,12 @@ export default {
new RegExp('cid:'+a.ContentID, 'g'),
window.location.origin+'/api/'+d.ID+'/part/'+a.PartID
);
} else if (a.FileName.match(/^[a-zA-Z\_\-\.]+$/)) {
// some old email clients use the filename
d.HTML = d.HTML.replace(
new RegExp('src=(\'|")'+a.FileName+'(\'|")', 'g'),
'src="'+window.location.origin+'/api/'+d.ID+'/part/'+a.PartID+'"'
);
}
}
}
@ -185,6 +191,12 @@ export default {
new RegExp('cid:'+a.ContentID, 'g'),
window.location.origin+'/api/'+d.ID+'/part/'+a.PartID
);
} else if (a.FileName.match(/^[a-zA-Z\_\-\.]+$/)) {
// some old email clients use the filename
d.HTML = d.HTML.replace(
new RegExp('src=(\'|")'+a.FileName+'(\'|")', 'g'),
'src="'+window.location.origin+'/api/'+d.ID+'/part/'+a.PartID+'"'
);
}
}
}