以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 老师,QQ邮箱的正文我发送一张图片,但不是以附件的形式,怎么写? (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=142803) |
|
-- 作者:fntfgz -- 发布时间:2019/11/6 16:33:00 -- 老师,QQ邮箱的正文我发送一张图片,但不是以附件的形式,怎么写? 如下图所示 [此贴子已经被作者于2019/11/6 16:33:44编辑过]
|
|
-- 作者:有点蓝 -- 发布时间:2019/11/6 16:46:00 -- 参考: Dim client As New System.Net.Mail.SmtpClient() client.Host = "smtp.qq.com" client.Credentials = New System.Net.NetworkCredential("455189993@qq.com", "helen6849338.") client.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network Dim message As New System.Net.Mail.MailMessage message.From = new System.Net.Mail.MailAddress("455189993@qq.com") message.To.Add("2450314695@qq.com") message.Subject = "主题测试" message.BodyEncoding = System.Text.Encoding.UTF8 message.IsBodyHtml = True Dim attach1 As new System.Net.Mail.Attachment("D:\\a.jpg", System.Net.Mime.MediaTypeNames.Image.Jpeg); attach1.C \'设置ContentId Dim body As String = "<html><body>内容</body></html>" Dim content As String = "12345678<font size=7 color=red>12345678</font><img src=""cid:pic1""/><p>来自张三.</p>" message.Body = body.Replace("内容", content) Try client.Send(message) msgbox("发送成功") Catch ex As Exception msgbox("发送失败:" & ex.message) End Try |
|
-- 作者:fntfgz -- 发布时间:2019/11/7 17:01:00 -- 老师,提示这个错误
|
|
-- 作者:有点蓝 -- 发布时间:2019/11/7 17:03:00 -- Dim attach1 As new System.Net.Mail.Attachment("D:\\a.jpg", System.Net.Mime.MediaTypeNames.Image.Jpeg); attach1.ContentId ="pic1" \'设置ContentId
|
|
-- 作者:fntfgz -- 发布时间:2019/11/7 17:10:00 -- 老师,现在不报错了,可以正常发送邮件,但就是图片还是不显示,好像发过去了,就是不显示 |
|
-- 作者:有点蓝 -- 发布时间:2019/11/7 17:13:00 -- 贴出使用的完整代码 |
|
-- 作者:fntfgz -- 发布时间:2019/11/7 17:13:00 -- Dim client As New System.Net.Mail.SmtpClient() client.Host = "smtp.qq.com" client.Credentials = New System.Net.NetworkCredential("403781500@qq.com", "ksayuuikttyhbgfa") client.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network Dim message As New System.Net.Mail.MailMessage message.From = new System.Net.Mail.MailAddress("403781500@qq.com") message.To.Add("858142201@qq.com") message.Subject = "主题测试" message.BodyEncoding = System.Text.Encoding.UTF8 message.IsBodyHtml = True Dim attach1 As new System.Net.Mail.Attachment("D:\\a.jpg", System.Net.Mime.MediaTypeNames.Image.Jpeg) attach1.C Dim body As String = "<html><body>内容</body></html>" Dim content As String = "12345678<font size=7 color=red>12345678</font><img src=""cid:pic1""/><p>来自张三.</p>" message.Body = body.Replace("内容", content) Try
client.Send(message) msgbox("发送成功") Catch ex As Exception msgbox("发送失败:" & ex.message) End Try [此贴子已经被作者于2019/11/7 17:14:52编辑过]
|
|
-- 作者:有点蓝 -- 发布时间:2019/11/7 17:28:00 -- 有D:\\a.jpg"这个文件吗? [此贴子已经被作者于2019/11/7 17:27:42编辑过]
|
|
-- 作者:fntfgz -- 发布时间:2019/11/7 17:31:00 -- 有的,老师您测试可以吗? [此贴子已经被作者于2019/11/7 17:37:23编辑过]
|
|
-- 作者:有点蓝 -- 发布时间:2019/11/7 17:46:00 --
|