亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

發送圖片郵件

構建content時,img標簽里面的cid是什么

正在回答

2 回答

public?void?img(String?to,?String?subject,?String?text,?String?file,String?rcid)?throws?MessagingException?{????MimeMessage?mm?=?sender.createMimeMessage();????MimeMessageHelper?helper?=?new?MimeMessageHelper(mm,true);????helper.setFrom(from);????helper.setTo(to);????helper.setSubject(subject);????String?content?=?text+"<img?src?=?\'cid:"+rcid+"\'>";????helper.setText(content,true);????FileSystemResource?fileSystemResource?=?new?FileSystemResource(new?File(file));????helper.addInline(rcid,fileSystemResource);????sender.send(mm);}//注:①cid這行代碼中的\'不能缺少;//②setText()方法要放在addInline()方法之前,否則圖片不能正常顯示。


0 回復 有任何疑惑可以回復我~

我也不是很清楚,我發送圖片也不顯示,檢查了一下元素發現我的路徑錯了,自己電腦沒穿墻所以訪問不了。

0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消
Spring Boot 發送郵件
  • 參與學習       15423    人
  • 解答問題       70    個

通過這個課程你將學會如何通過 Spring Boot 設計郵件系統

進入課程

發送圖片郵件

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號