mimekit

MimeKit: How to embed images?

浪子不回头ぞ 提交于 2019-11-30 11:28:18
I am using MailKit/MimeKit 1.2.7 (latest NuGet version). I tried to embed an image in the HTML body of my email by following the sample from the API documentation (section "Using a BodyBuilder"). My current code looks like this: var builder = new BodyBuilder(); builder.HtmlBody = @"<p>Hey!</p><img src=""Image.png"">"; var pathImage = Path.Combine(Misc.GetPathOfExecutingAssembly(), "Image.png"); builder.LinkedResources.Add(pathLogoFile); message.Body = builder.ToMessageBody(); I can send this email and in fact the image is attached to the email. But it is not embedded. Am I missing something?

MimeKit: How to embed images?

半城伤御伤魂 提交于 2019-11-29 16:57:39
问题 I am using MailKit/MimeKit 1.2.7 (latest NuGet version). I tried to embed an image in the HTML body of my email by following the sample from the API documentation (section "Using a BodyBuilder"). My current code looks like this: var builder = new BodyBuilder(); builder.HtmlBody = @"<p>Hey!</p><img src=""Image.png"">"; var pathImage = Path.Combine(Misc.GetPathOfExecutingAssembly(), "Image.png"); builder.LinkedResources.Add(pathLogoFile); message.Body = builder.ToMessageBody(); I can send this

MailKit save Attachments

我只是一个虾纸丫 提交于 2019-11-29 13:09:41
I'm try save attachments from message foreach(MimeKit.MimeEntity at message.Attachments) { at.WriteTo("nameFile"); } File saved, but when I open I get the error the file is corrupted or too large The size of this file is 88 kb, but size of the file should be equal to 55 kb. I think that in all recorded message file. How do I only record the attachment? MailKit v1.2.0.0 MimeKit 1.2.0.0 You are saving the entire MIME object (including the headers). What you need to do is save the content. foreach (var attachment in message.Attachments) { using (var stream = File.Create ("fileName")) { if

How to send HTML message via Mimekit/Mailkit

↘锁芯ラ 提交于 2019-11-29 01:04:43
BodyBuilder bodyBuilder = new BodyBuilder(); messageContent.Body = "<b>This is a test mail</b>"; bodyBuilder.HtmlBody = messageContent.Body; I tried to embed my body to a bodybuilder but when I received the email, it returned an empty body. I have an exception that would throw an argument if the body is empty.. Using a BodyBuilder like you are doing is probably the easiest way. var bodyBuilder = new BodyBuilder (); bodyBuilder.HtmlBody = "<b>This is some html text</b>"; bodyBuilder.TextBody = "This is some plain text"; message.Body = bodyBuilder.ToMessageBody (); client.Send (message); MimeKit

MailKit save Attachments

﹥>﹥吖頭↗ 提交于 2019-11-28 07:02:45
问题 I'm try save attachments from message foreach(MimeKit.MimeEntity at message.Attachments) { at.WriteTo("nameFile"); } File saved, but when I open I get the error the file is corrupted or too large The size of this file is 88 kb, but size of the file should be equal to 55 kb. I think that in all recorded message file. How do I only record the attachment? MailKit v1.2.0.0 MimeKit 1.2.0.0 回答1: You are saving the entire MIME object (including the headers). What you need to do is save the content.