Questions tagged [mailkit]

MailKit is a cross-platform .NET mail-client library optimized for mobile.

MailKit is a cross-platform .NET mail-client library optimized for mobile, it is built on top of MimeKit.

785 questions
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
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
2 answers

MailKit.Security.SslHandshakeException: The host name did not match the name given in the server's SSL certificate. ASP.NET Core, Nginx

When I try to send an email message via Google and the MailKit library on a production containerized application I get this exception: MailKit.Security.SslHandshakeException: An error occurred while attempting to establish an SSL or TLS connection.…
Petro Kopyl
  • 91
  • 1
  • 2
  • 3
7
votes
1 answer

Asp.Net Core MailKit: The remote certificate is invalid according to the validation proceedure

I have a question regarding email sending on asp.net core. So I have this code: private void SendEmailLocalSMTP(string email, string subject, string message) { MimeMessage mailMsg = new MimeMessage(); //TESTING ENVIRONMENT ONLY!!! …
Carlos Jimenez Bermudez
  • 1,070
  • 1
  • 14
  • 36
7
votes
1 answer

c# MailKit - Read receipt

Does anybody know if MailKit supports a read receipt (reply message on read)? I have not found anything on the web or on Stackoverflow.
SiL3NC3
  • 690
  • 6
  • 29
7
votes
1 answer

Add Imap Folder Mailkit

Im trying to add a top level folder using Mailkit so when I add the following labels I am able to group them under this folder. The labels are: mailkit/archive mailkit/flagged I want to create a folder called mailkit so gmail groups them but I…
Jaybeecave
  • 827
  • 2
  • 8
  • 17
7
votes
2 answers

MailKit : Obtaining new mail notification from IMAP server

I need to create a service (or console) app that connects to an IMAP server and listens for new mail. I'm currently trying to use MailKit but I'm having trouble trying to figure out how to accomplish this from the documentation. The closest I've…
RHarris
  • 10,641
  • 13
  • 59
  • 103
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
6
votes
2 answers

Recommended way to use smtp4dev as server of mailkit client messages

I have an console application and I installed mailkit package for messaging purposes. I have code in the main method to test mailkit smtp client. I have smtp4dev dummy server running and the client code is the example code of mailkit in github with…
Dalsier
  • 377
  • 3
  • 14
6
votes
1 answer

Retrieve IMAP Subfolders

I am trying to retrieve the subfolders and messages from the inbox but i was only able to retrieve the parent subfolders, also tried with PersonalNamespaces[0] var inbox = client.Inbox; inbox.Open (FolderAccess.ReadWrite); Debug.WriteLine ("Total…
user3430435
  • 71
  • 1
  • 3
6
votes
3 answers

Strip attachments from emails using MailKit / MimeKit

I'm using MailKit library to handle emails, which has been working well. However, I'm trying to split emails into their constituent files a) Main email (no attachments) b) Individual attachment files, to store on the filesystem. I can save the…
FrugalTPH
  • 533
  • 2
  • 6
  • 25
5
votes
3 answers

Mailkit does not authenticate with credentials

I'm trying to send an email with Gmail account. I was able to send emails with yahoo, however, it doesn't work anymore, for some unknown reason. Which i posted a question about that as well, but not response. In this instance, i'm trying to connect…
Csibi Norbert
  • 780
  • 1
  • 11
  • 35
5
votes
5 answers

Using MailKit to send through Outlook.com

I'm trying to send an email through my Outlook.com email address using MailKit. I've followed all the examples I've seen online and this is what I have: public async Task SendEmailAsync(string email, string subject, string htmlmessage) { var…
RHarris
  • 10,641
  • 13
  • 59
  • 103
1 2
3
52 53