簡體   English   中英

郵件內嵌圖像顯示錯誤?

[英]Mail Inline Images display Error?

在線郵件客戶端(例如gmail)是否可以顯示以嵌入式方式發送(即嵌入在郵件中)的圖像?

用電子郵件發送圖像的最佳方法是什么? 在線發送鏈接是最好的,因為大多數在線客戶端都支持嗎?

通常,如果在郵件中正確inlined圖像,則Gmail等郵件客戶端會適當顯示內嵌圖像。 在grails中的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]
        }

通常,它取決於電子郵件客戶端根據其設置呈現消息。 但是,根據以上示例的實際實施已顯示出積極的結果。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM