简体   繁体   English

如何使用 Excel VBA 从 Thunderbird 发送 email 主体中的图像?

[英]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.

as in this post . 就像在这篇文章中一样

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.

相关问题 如何使用 Excel VBA 从 Thunderbird 自动发送电子邮件? - How can I automatically send email from Thunderbird with Excel VBA? 如何通过Excel VBA使用Mozilla Thunderbird生成和发送电子邮件 - How to generate and send an email using Mozilla Thunderbird through Excel VBA 使用VBA,如何将选定的Excel单元格发送到具有html格式的电子邮件正文? - using VBA how can I send a selection of Excel Cells to an Email Body with html formatting? VBA Excel:如何通过电子邮件发送保存在硬盘上Excel中的图像? - VBA Excel: How can I send an image saved in Excel on my hard drive in an email? 如何从 Excel VBA 在自动电子邮件正文上加粗或着色文本 - How to Bold or color text on auto email body from Excel VBA 如何从 Excel vba 添加到 email body 的多个超链接 - How to add multiple hyperlinks to email body from Excel vba 如何从excel发送电子邮件中的嵌入图像 - How to send an embedded image in email from excel 使用 Excel VBA 发送带有粘贴到电子邮件正文中的过滤器范围的电子邮件 - Send Email With A Filter Range Pasted Into Email Body using Excel VBA 使用 VBA 从 Excel 格式化电子邮件正文 - Formatting email body from Excel using VBA 如何从Excel的电子邮件正文中发送形状对象? - How to send a shape object from Excel in the body of an Email?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM