[英]How can I send an image in the email body from Thunderbird with Excel VBA?
How can I send an image in the email body from Thunderbird with Excel VBA?如何使用 Excel VBA 从 Thunderbird 发送 email 主体中的图像?
thundnd = "C:\Program Files (x86)\Mozilla Thunderbird\thunderbird.exe " & "-compose " & Chr(34) & _
"to='" & email & "'," & "subject='" & subj & "'," & "body='" & body & "'," & "format=1," & Chr(34)
Call Shell (thundnd, vbNormalFocus)
I want to send an image, not in the attachment, but inside the HTML body of the email.我想发送一张图片,不是在附件中,而是在 email 的 HTML 主体内。
In VBA I encode the image in String using EncodeBase64.在 VBA 中,我使用EncodeBase64 将图像编码为字符串。
In the results, I get a jump to the next line after 72 characters.结果,我在 72 个字符后跳转到下一行。
/9j/4AAQSkZJRgABAQEAYABgAAD/4RCERXhpZgAATU0AKgAAAAgABAE7AAIAAAAGAAAISodp
AAQAAAABAAAIUJydAAEAAAAMAAAQcOocAAcAAAgMAAAAPgAAAAAc6gAAAAgAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
I insert it into the body我把它插入身体
<img src="data:image/png;base64,/9j/4AAQSkZJRgABAQEAYABgAAD/4RCERXhpZgAATU0AKgAAAAgABAE7AAIAAAAGAAAISodp"
aaqaaaabaaaiujydaaeaaaamaaaqcoocaacaaagmaaaapgaaaaac6gaaaagaaaaaaaaaaaaa="" e.t.c.
I found a simple answer.我找到了一个简单的答案。
Edit encoded string and replace characters: vbLf (Line feed)编辑编码字符串并替换字符:vbLf(换行)
correctPicture = Replace(Mid(bytes, 1), vbLf, "")
Now it is working.现在它正在工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.