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
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
40
votes
1 answer

How can I mark a message as read in MailKit

I use MailKit to read some messages from a GMail Account. Works great, but when my application has read a message, I want to mark the message as read, and save that state to GMail. Is this possible with MailKit? I have not found anything about it…
René Pjengaard
  • 411
  • 1
  • 4
  • 4
33
votes
2 answers

How to send email by using MailKit?

According to the new google politics https://googleonlinesecurity.blogspot.de/2014/04/new-security-measures-will-affect-older.html I can't sent an email. "Less secure apps" are considered for google the application which don't use OAuth 2.0. I would…
Anatoly
  • 1,908
  • 4
  • 25
  • 47
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
20
votes
3 answers

Can I send SMTP email through Office365 shared mailbox?

We are thinking about moving to O365; however, we developed software that uses our current Exchange server to send email both to external users as well as to a support box when errors occur. I've been testing this to ensure that the code we have in…
RHarris
  • 10,641
  • 13
  • 59
  • 103
20
votes
1 answer

When is it necessary to enable SSL on MailKit

I read on the Microsoft website that the SmtpClient was obsolete and they recommended using the MailKit for it's replacement. I'm in the process of writing an application to make use of the MailKit. This is what I have so far: // ***************…
TechGuy
  • 327
  • 3
  • 7
19
votes
1 answer

Sending Email to SpecifiedPickupDirectory with MailKit

I was using SmtpClient till now with ASP.NET MVC 5. For testing email send functionality on local system, I was using client.DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory; Now, I want to do the same things in ASP.NET Core which does…
vivek
  • 1,595
  • 2
  • 18
  • 35
19
votes
5 answers

Mailkit SMTP - StartTLS & TLS flags

I am trying to connect to iCloud via SmtpClient The settings I am using are as follows: Server name: smtp.mail.me.com SSL Required: Yes If you see an error message when using SSL, try using TLS or STARTTLS instead. Port: 587 SMTP Authentication…
Jaybeecave
  • 827
  • 2
  • 8
  • 17
18
votes
4 answers

SslHandshakeException: An error occurred while attempting to establish an SSL or TLS connection

I'm trying to access gmail emails using imap and the code is failing at the ssl handshake without showing me any errors. Really appreciate if anyone could please help with this. I've built this using xunit, .NET Core 2.1. I'm using MailKit Nuget …
Yohan Blake
  • 1,298
  • 4
  • 21
  • 43
16
votes
1 answer

I'm getting a MailKit.Security.SslHandshakeException when trying to connect to "smtp.office365.com"

I am trying to use MailKit to send an email message via "smtp.office365.com". Here is the code I'm using. using (var client = new SmtpClient(new ProtocolLogger("smtp.log"))) { client.ServerCertificateValidationCallback = (s, c, h, e) => true; …
Dave F
  • 821
  • 1
  • 9
  • 20
14
votes
1 answer

MailKit C# SmtpClient.Connect() to Office 365 generating exception: "An existing connection was forcibly closed by the remote host"

I have a problem sending email via Office 365 SMTP and MailKit. The exception I get is: Unhandled Exception: System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote…
Ogglas
  • 62,132
  • 37
  • 328
  • 418
12
votes
1 answer

Send email using Html template with MailKit in .net core application

I am sending an email from .net core application using MailKit, and it will sent it successfully. But I want to use HTML template to send email with MailKit in .Net core. Here are the code currently sending email with static body part var…
Herin
  • 704
  • 3
  • 18
  • 34
11
votes
1 answer

Changing name of automatic attached file in e-mail

I am using Mailkit library to send e-mails. This is the code to do so: public async Task SendAsync(IdentityMessage message) { if (message == null) return; LinkedResource inline = new…
jstuardo
  • 3,901
  • 14
  • 61
  • 136
11
votes
1 answer

MailKit: What is the best practice of using Client.Disconnect(...)

I have recently used Mailkit lib in our project in order replacing .NET SmtpClient. We have 2 business cases to use the SmtpClient to send emails. In one instance we use SmtpClient to send queued emails in a separate process and other instance we…
RSF
  • 510
  • 6
  • 18
1
2 3
52 53