Questions tagged [mimekit]

A cross-platform .NET MIME creation and parser library with support for S/MIME, PGP, TNEF and Unix mbox spools.

A cross-platform .NET MIME creation and parser library with support for S/MIME, PGP, TNEF and Unix mbox spools.

MimeKit is a C# library which may be used for the creation and parsing of messages using the Multipurpose Internet Mail Extension (MIME), as defined by numerous IETF specifications.

303 questions
80
votes
3 answers

Can I send files via email using MailKit?

As the title, is MailKit supported to send file? If yes, how can I do it?
KlynkC
  • 949
  • 1
  • 6
  • 11
60
votes
4 answers

How to send HTML message via Mimekit/Mailkit

BodyBuilder bodyBuilder = new BodyBuilder(); messageContent.Body = "This is a test mail"; 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…
astropringles
  • 799
  • 1
  • 7
  • 17
26
votes
1 answer

MailKit save Attachments

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…
sergpc
  • 305
  • 1
  • 4
  • 11
26
votes
2 answers

MimeKit: How to embed images?

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…
Ingmar
  • 1,525
  • 6
  • 34
  • 51
10
votes
1 answer

Reply to a Mail in Mailkit

i'm using Mailkit library (Imap) for my project. I can comfortably send a new message by SmtpClient. currently I'm digging about how to reply to a particular mail. and is it possible to add more recipients to that reply mail ? @jstedfast thanks…
10
votes
1 answer

Forward email using MailKit (C#)

I'm trying to access to an IMAP account using MailKit (created by jstedfast) I manage to download the message (as a MimeMessage), and at some point I need to "forward" it to another account. How would be the best way to do it, in order to preserve…
Xavi Ivars
  • 634
  • 8
  • 22
9
votes
1 answer

Collecting SMTP server using Mailkit with Mimekit

While trying to send an e-mail using MailKit and MimeKit,is there a way to collect the SMTP Output?. ps: I am trying to migrate my email code from Easymail to Mimekit and Mailkit and I apologize if this is a rather basic query.
9
votes
1 answer

MimeKit.MimeMessage to Browser-Renderable HTML

Is there a way to convert a MimeKit.MimeMessage to HTML that can be rendered in a web browser? I'm not concerned with message attachments, but would like to be able to display the message body, complete with embedded images, in a browser. I'm new to…
Blake
  • 200
  • 3
  • 10
8
votes
1 answer

Is there a way to save the email as a file while using MailKit c#?

I would like to save the entire email to the disk with all the headers instead to relay to an SMTP server using MimeKit, is this possible?. I am aware that the Message itself can be written into a file.
8
votes
2 answers

Get attachments in an array of bytes using MimeKit in C#

How can I get the attachment content when using MimeKit? This is what I have: var mimeMessage = MimeMessage.Load(@"test.eml"); var attachments = mimeMessage.Attachments.ToList(); foreach (var attachment in attachments) { // how do I get the…
Shak Ham
  • 1,209
  • 2
  • 9
  • 27
8
votes
1 answer

MailKit Imap get read and unread status of a mail

I am using MailKit to read messages from a gmail account. Works great. But, I want to get the message status as whether its read, unread, important, starred etc. Is this possible with MailKit? I can´t seem to find anything about it. Here is my…
7
votes
1 answer

MimeKit: How to delete an email by MessageId?

I am using MailKit/MimeKit 1.2.7 (latest NuGet version). Deleting an email with the ImapClient is pretty easy ... client.Inbox.AddFlags(uniqueId, MessageFlags.Deleted, silent: true); ... if you know the emails UniqueId or its Index. In my case, I…
Ingmar
  • 1,525
  • 6
  • 34
  • 51
6
votes
3 answers

System.IO.FileLoadException: Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1

I've been using Mailkit 2.15 and now trying to upgrade to v3.4.1. When I upgraded, all its dependencies got installed including System.Runtime.CompilerServices.Unsafe v4.5.3. But when I execute the code, the following exception occurs. 13-Oct-2022…
pradeep
  • 175
  • 1
  • 13
6
votes
1 answer

filter email with attachment using mimekit/mailkit

is there a way to filter emails with attachments only? I'm using this code using (var client = new ImapClient()) { client.Connect(IMAPServer, IMAPport, IMAPSSL); client.AuthenticationMechanisms.Remove("XOAUTH2"); …
Ran Lorch
  • 73
  • 8
6
votes
2 answers

Should I dispose the stream used by MimeKit when sending e-mails with attachments?

I was playing around with MailKit/MimeKit and something is bugging me. I wanted to send e-mails with attachments using streams. MimeKit offers the BodyBuilderclass which makes it very easy to create the body message and attach files: public void…
jpgrassi
  • 5,482
  • 2
  • 36
  • 55
1
2 3
20 21