Обычно почтовые клиенты, такие как Gmail, отображают встроенное изображение соответствующим образом, если изображение правильно inlined
по почте. В контексте с mail
плагин в Грааль, я был в состоянии достигнуть встроенного изображения в Gmail, делая что-то вроде:
sendMail {
multipart true
// we send the image type regardless if the email client renders in html or plain text. If plain text
// jpg will be attached. Not a lot can be done since we do not know how the email client will render.
// if html, then image will be embedded in html and will not be attached and will be downloaded since image is not
// being loaded from external site.
if(filesToAttach){
filesToAttach.each{ file ->
inline file.tokenize(".").get(0), "image/jpeg", new ClassPathResource("/${file}", this.getClass())
}
}
to recipient
from from
subject subject
html view: view, model: [//my model]
}
Как правило, это зависит от почтового клиента, чтобы сделать сообщение в соответствии с его установкой. Однако фактическая реализация в соответствии с приведенным выше примером показала положительные результаты.