mailkit

How to use Mailkit to retrieve emails from Gmail

僤鯓⒐⒋嵵緔 提交于 2020-03-25 05:51:49
问题 I asked the same question a few days ago, the Author of MailKit helped and showed me the working code. A few days later, when I am back to the project, I run the same code, it stopped working. I noticed that Google has updated its UI The new Application Type List: The old list: Could anyone shed light on this ever changing Gmail API please? 来源: https://stackoverflow.com/questions/60830442/how-to-use-mailkit-to-retrieve-emails-from-gmail

How do I connect to Exchange Online using OAuth 2.0 in MailKit?

安稳与你 提交于 2020-03-21 10:11:21
问题 I have a web application that sends e-mails to users via Exchange Online (Office365) using MailKit and Basic Authentication. Our company is MS partner and therefor is obligated to turn off Basic Authentication for our services by the end of february 2020. So, I want to use OAuth 2.0 to connect to Exchange Online, similar to this example. In fact, there might be a solution available according to this answer but I'm unable to find anything about it. Right now I'm playing around with MS Identity

MailKit: How to download all attachments locally from a MimeMessage

≡放荡痞女 提交于 2020-01-24 13:52:25
问题 I have looked at other examples online, but I am unable to figure out how to download and store ALL the attachments from a MimeMessage object. I did look into the WriteTo(), but I could not get it to work. Also wondering whether attachments will be saved according to the original file name, and type inside the email. Here is what I have so far: using (var client = new ImapClient()) { client.Connect(Constant.GoogleImapHost, Constant.ImapPort, SecureSocketOptions.SslOnConnect); client

Connecting to gmail with Mailkit ImapClient using TLS not SSL

混江龙づ霸主 提交于 2020-01-15 08:17:08
问题 I'm trying to poll a gmail account in C# code. I am using the Mailkit libraries (https://github.com/jstedfast/MailKit). I can connect successfully when I tell the client to use SSL: using (var client = new ImapClient ()) { client.Connect ("imap.friends.com", 993, true); client.Authenticate ("joey", "password"); client.Disconnect (true); } But it's my understanding (possibly wrong) that SSL is insecure and we shouldn't be using it. So I'm trying to force a TLS connection: using (var client =

System.OutOfMemoryException while downloading a lot of attachments with MailKit

时光毁灭记忆、已成空白 提交于 2020-01-07 05:41:11
问题 I'm downloading attachments from few e-mail accounts. I have for example 300 attachments on each account (they are mirrors). When I want download attachments only from one account, I get error in my program log: ... 09.04.2017 16:10:07: Download attachment nr 108 from task Movie.avi 09.04.2017 16:10:59: Download attachment nr 109 from task Movie.avi 09.04.2017 16:11:26: Download attachment nr 110 from task Movie.avi 09.04.2017 16:12:07: Download attachment nr 111 from task Movie.avi 09.04

Mailkit Fetch “Unexpected token in IMAP response: [qstring: ”Multipart message“]”

懵懂的女人 提交于 2020-01-06 08:30:24
问题 I'm getting an ImapProtocolException with a message: "Unexpected token in IMAP response: [qstring: "Multipart message"]" when issuing zInbox.Fetch(uids, MailKit.MessageSummaryItems.UniqueId Or MailKit.MessageSummaryItems.BodyStructure Or MailKit.MessageSummaryItems.Envelope) But on the other hand if I use GetMessage(uids) all goes fine, no error. Here is ProtocolLogger from Fetch (you can notice no Fetch Completed message): C: A00000790 UID FETCH 97824 (UID ENVELOPE BODYSTRUCTURE) S: * 24320

Unexpected “ The remote certificate is invalid according to the validation procedure.”

假如想象 提交于 2020-01-05 05:33:25
问题 I am trying to connect to an SMTP server from a .NetCore/Ubuntu machine via Mailkit. I am attempting to connect to port 25 on the server with SSL turned off. The mail server is a windows server on the local lan, and works fine from other machines with the same settings as are being used on the problem Ubuntu machine. The code being used to connect is as follows: using (var client = new SmtpClient()) { client.Connect("smtp.mydomain.com", 25,false); client.Authenticate(username, password);

Mimekit adds the rtf as an attachment and not the body

江枫思渺然 提交于 2019-12-25 16:09:54
问题 Using the following code the rtf body of the winmail.dat file is added as an attachment to the saved email not the body: using (Stream stream = File.Open(path, FileMode.Open, FileAccess.Read, FileShare.None)) { MimeKit.MimeMessage mimeMessage = MimeKit.MimeMessage.Load(stream); int i = 1; foreach (MimeKit.MimePart attachment in mimeMessage.Attachments) { if (attachment.GetType() == typeof(MimeKit.Tnef.TnefPart)) { MimeKit.Tnef.TnefPart tnefPart = (MimeKit.Tnef.TnefPart)attachment; MimeKit

Mimekit adds the rtf as an attachment and not the body

坚强是说给别人听的谎言 提交于 2019-12-25 16:08:52
问题 Using the following code the rtf body of the winmail.dat file is added as an attachment to the saved email not the body: using (Stream stream = File.Open(path, FileMode.Open, FileAccess.Read, FileShare.None)) { MimeKit.MimeMessage mimeMessage = MimeKit.MimeMessage.Load(stream); int i = 1; foreach (MimeKit.MimePart attachment in mimeMessage.Attachments) { if (attachment.GetType() == typeof(MimeKit.Tnef.TnefPart)) { MimeKit.Tnef.TnefPart tnefPart = (MimeKit.Tnef.TnefPart)attachment; MimeKit

Send to a recipient, while listing others in the sent-to list

梦想的初衷 提交于 2019-12-24 13:35:04
问题 I'd like to send an email to a single person, yet have the "sent to" list display a number of people. (I don't want those other people to receive the email). A number of articles (here and here) suggest it's perfectly legal to specify different values for smtp address and mime addresses. I'm using MailKit and this is what I have so far: var message = new MimeMessage(); message.From.Add(new MailboxAddress("MeetingOfficeA", "noreply@office.com")); message.To.Add(new MailboxAddress("Fidel Perez