Skip to content

Commit

Permalink
Updated README.md and FAQ.md to use https links
Browse files Browse the repository at this point in the history
  • Loading branch information
jstedfast committed Feb 10, 2024
1 parent 10ac4eb commit 2cda188
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 58 deletions.
94 changes: 47 additions & 47 deletions FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ apt update && apt install -y ca-certificates
```

Another option is to work around this problem by supplying a custom [RemoteCertificateValidationCallback](https://msdn.microsoft.com/en-us/library/ms145054)
and setting it on the client's [ServerCertificateValidationCallback](http://mimekit.net/docs/html/P_MailKit_MailService_ServerCertificateValidationCallback.htm)
and setting it on the client's [ServerCertificateValidationCallback](https://mimekit.net/docs/html/P_MailKit_MailService_ServerCertificateValidationCallback.htm)
property.

In the simplest example, you could do something like this (although I would strongly recommend against it in
Expand Down Expand Up @@ -184,7 +184,7 @@ they *do* go down or are otherwise unreachable due to other network problems bet
it becomes impossible to check the revocation status of one or more of the certificates in the chain.

To ignore revocation checks, you can set the
[CheckCertificateRevocation](http://www.mimekit.net/docs/html/P_MailKit_IMailService_CheckCertificateRevocation.htm)
[CheckCertificateRevocation](https://www.mimekit.net/docs/html/P_MailKit_IMailService_CheckCertificateRevocation.htm)
property of the IMAP, POP3 or SMTP client to `false` before you connect:

```csharp
Expand All @@ -206,7 +206,7 @@ the SSL and TLS protocols that are not supported by default are: SSL v2.0, SSL v

You can override MailKit's default set of supported
[SSL and TLS protocols](https://docs.microsoft.com/en-us/dotnet/api/system.security.authentication.sslprotocols?view=netframework-4.8)
by setting the value of the [SslProtocols](http://www.mimekit.net/docs/html/P_MailKit_MailService_SslProtocols.htm)
by setting the value of the [SslProtocols](https://www.mimekit.net/docs/html/P_MailKit_MailService_SslProtocols.htm)
property on your SMTP, POP3 or IMAP client.

For example:
Expand All @@ -225,9 +225,9 @@ using (var client = new SmtpClient ()) {
### <a id="protocol-log">Q: How can I get a protocol log for IMAP, POP3, or SMTP to see what is going wrong?</a>

All of MailKit's client implementations have a constructor that takes a nifty
[IProtocolLogger](http://www.mimekit.net/docs/html/T_MailKit_IProtocolLogger.htm)
[IProtocolLogger](https://www.mimekit.net/docs/html/T_MailKit_IProtocolLogger.htm)
interface for logging client/server communications. Out of the box, you can use the
handy [ProtocolLogger](http://www.mimekit.net/docs/html/T_MailKit_ProtocolLogger.htm) class.
handy [ProtocolLogger](https://www.mimekit.net/docs/html/T_MailKit_ProtocolLogger.htm) class.
Here are some examples of how to use it:

```csharp
Expand Down Expand Up @@ -257,7 +257,7 @@ intended to behave according to their protocol specifications, you'll need to lo
GMail account via your web browser and navigate to the `Forwarding and POP/IMAP` tab of your
GMail Settings page and set your options to look like this:

![GMail POP3 and IMAP Settings](http://content.screencast.com/users/jeff.xamarin/folders/Jing/media/7d50dada-6cb0-4ab1-b117-8600fb5e07d4/00000022.png "GMail POP3 and IMAP Settings")
![GMail POP3 and IMAP Settings](https://content.screencast.com/users/jeff.xamarin/folders/Jing/media/7d50dada-6cb0-4ab1-b117-8600fb5e07d4/00000022.png "GMail POP3 and IMAP Settings")

### <a id="gmail-access">Q: How can I access GMail using MailKit?</a>

Expand Down Expand Up @@ -341,7 +341,7 @@ then add MIME parts to it that contain the content of the files you'd like to at
the `Content-Disposition` header value to attachment. You'll probably also want to set the `filename`
parameter on the `Content-Disposition` header as well as the `name` parameter on the `Content-Type`
header. The most convenient way to do this is to use the
[MimePart.FileName](http://www.mimekit.net/docs/html/P_MimeKit_MimePart_FileName.htm) property which
[MimePart.FileName](https://www.mimekit.net/docs/html/P_MimeKit_MimePart_FileName.htm) property which
will set both parameters for you as well as setting the `Content-Disposition` header value to `attachment`
if it has not already been set to something else.

Expand Down Expand Up @@ -383,7 +383,7 @@ message.Body = multipart;
```

A simpler way to construct messages with attachments is to take advantage of the
[BodyBuilder](http://www.mimekit.net/docs/html/T_MimeKit_BodyBuilder.htm) class.
[BodyBuilder](https://www.mimekit.net/docs/html/T_MimeKit_BodyBuilder.htm) class.

```csharp
var message = new MimeMessage ();
Expand Down Expand Up @@ -411,7 +411,7 @@ builder.Attachments.Add (@"C:\Users\Joey\Documents\party.ics");
message.Body = builder.ToMessageBody ();
```

For more information, see [Creating Messages](http://www.mimekit.net/docs/html/Creating-Messages.htm).
For more information, see [Creating Messages](https://www.mimekit.net/docs/html/Creating-Messages.htm).

### <a id="message-body">Q: How can I get the main body of a message?</a>

Expand Down Expand Up @@ -480,15 +480,15 @@ There are a few common message structures:
<a name="message-body-tldr"></a>Now, if you don't care about any of that and just want to get the text of
the first `text/plain` or `text/html` part you can find, that's easy.

[MimeMessage](http://www.mimekit.net/docs/html/T_MimeKit_MimeMessage.htm) has two convenience properties
for this: [TextBody](http://www.mimekit.net/docs/html/P_MimeKit_MimeMessage_TextBody.htm) and
[HtmlBody](http://www.mimekit.net/docs/html/P_MimeKit_MimeMessage_HtmlBody.htm).
[MimeMessage](https://www.mimekit.net/docs/html/T_MimeKit_MimeMessage.htm) has two convenience properties
for this: [TextBody](https://www.mimekit.net/docs/html/P_MimeKit_MimeMessage_TextBody.htm) and
[HtmlBody](https://www.mimekit.net/docs/html/P_MimeKit_MimeMessage_HtmlBody.htm).

`MimeMessage.HtmlBody`, as the name implies, will traverse the MIME structure for you and find the most
appropriate body part with a `Content-Type` of `text/html` that can be interpreted as the message body.
Likewise, the `TextBody` property can be used to get the `text/plain` version of the message body.

For more information, see [Working with Messages](http://www.mimekit.net/docs/html/Working-With-Messages.htm).
For more information, see [Working with Messages](https://www.mimekit.net/docs/html/Working-With-Messages.htm).

### <a id="has-attachments">Q: How can I tell if a message has attachments?</a>

Expand All @@ -498,7 +498,7 @@ typically the textual body of the message, but it is not always quite that simpl

In general, MIME attachments will have a `Content-Disposition` header with a value of `attachment`.
To get the list of body parts matching this criteria, you can use the
[MimeMessage.Attachments](http://www.mimekit.net/docs/html/P_MimeKit_MimeMessage_Attachments.htm) property.
[MimeMessage.Attachments](https://www.mimekit.net/docs/html/P_MimeKit_MimeMessage_Attachments.htm) property.

Unfortunately, not all mail clients follow this convention and so you may need to write your own custom logic.
For example, you may wish to treat all body parts having a `name` or `filename` parameter set on them:
Expand Down Expand Up @@ -786,8 +786,8 @@ property.
The MimeKit API was designed to use the existing MIME format for serialization. In light of this, the ability
to use the .NET serialization API and format did not make much sense to support.

You can easily serialize a [MimeMessage](http://www.mimekit.net/docs/html/T_MimeKit_MimeMessage.htm) to a stream using the
[WriteTo](http://www.mimekit.net/docs/html/Overload_MimeKit_MimeMessage_WriteTo.htm) methods.
You can easily serialize a [MimeMessage](https://www.mimekit.net/docs/html/T_MimeKit_MimeMessage.htm) to a stream using the
[WriteTo](https://www.mimekit.net/docs/html/Overload_MimeKit_MimeMessage_WriteTo.htm) methods.

For more information on this topic, see the following other two topics:

Expand All @@ -799,7 +799,7 @@ For more information on this topic, see the following other two topics:
One of the more common operations that MimeKit is meant for is parsing email messages from arbitrary streams.
There are two ways of accomplishing this task.

The first way is to use one of the [Load](http://www.mimekit.net/docs/html/Overload_MimeKit_MimeMessage_Load.htm) methods
The first way is to use one of the [Load](https://www.mimekit.net/docs/html/Overload_MimeKit_MimeMessage_Load.htm) methods
on `MimeMessage`:

```csharp
Expand All @@ -814,7 +814,7 @@ Or you can load a message from a file path:
var message = MimeMessage.Load ("message.eml");
```

The second way is to use the [MimeParser](http://www.mimekit.net/docs/html/T_MimeKit_MimeParser.htm) class. For the most
The second way is to use the [MimeParser](https://www.mimekit.net/docs/html/T_MimeKit_MimeParser.htm) class. For the most
part, using the `MimeParser` directly is not necessary unless you wish to parse a Unix mbox file stream. However, this is
how you would do it:

Expand All @@ -838,8 +838,8 @@ while (!parser.IsEndOfStream) {

### <a id="save-messages">Q: How can I save messages?</a>

One you've got a [MimeMessage](http://www.mimekit.net/docs/html/T_MimeKit_MimeMessage.htm), you can save
it to a file using the [WriteTo](http://mimekit.net/docs/html/Overload_MimeKit_MimeMessage_WriteTo.htm) method:
One you've got a [MimeMessage](https://www.mimekit.net/docs/html/T_MimeKit_MimeMessage.htm), you can save
it to a file using the [WriteTo](https://mimekit.net/docs/html/Overload_MimeKit_MimeMessage_WriteTo.htm) method:

```csharp
message.WriteTo ("message.eml");
Expand All @@ -849,7 +849,7 @@ The `WriteTo` method also has overloads that allow you to write the message to a

By default, the `WriteTo` method will save the message using DOS line-endings on Windows and Unix
line-endings on Unix-based systems such as macOS and Linux. You can override this behavior by
passing a [FormatOptions](http://mimekit.net/docs/html/T_MimeKit_FormatOptions.htm) argument to
passing a [FormatOptions](https://mimekit.net/docs/html/T_MimeKit_FormatOptions.htm) argument to
the method:

```csharp
Expand All @@ -870,7 +870,7 @@ single charset to do the conversion (which is *exactly* what `ToString` does).

### <a id="save-attachments">Q: How can I save attachments?</a>

If you've already got a [MimePart](http://www.mimekit.net/docs/html/T_MimeKit_MimePart.htm) that represents
If you've already got a [MimePart](https://www.mimekit.net/docs/html/T_MimeKit_MimePart.htm) that represents
the attachment that you'd like to save, here's how you might save it:

```csharp
Expand All @@ -880,7 +880,7 @@ using (var stream = File.Create (fileName))

Pretty simple, right?

But what if your attachment is actually a [MessagePart](http://www.mimekit.net/docs/html/T_MimeKit_MessagePart.htm)?
But what if your attachment is actually a [MessagePart](https://www.mimekit.net/docs/html/T_MimeKit_MessagePart.htm)?

To save the content of a `message/rfc822` part, you'd use the following code snippet:

Expand Down Expand Up @@ -911,26 +911,26 @@ foreach (var attachment in message.Attachments) {

### <a id="address-headers">Q: How can I get the email addresses in the From, To, and Cc headers?</a>

The [From](http://www.mimekit.net/docs/html/P_MimeKit_MimeMessage_From.htm),
[To](http://www.mimekit.net/docs/html/P_MimeKit_MimeMessage_To.htm), and
[Cc](http://www.mimekit.net/docs/html/P_MimeKit_MimeMessage_Cc.htm) properties of a
[MimeMessage](http://www.mimekit.net/docs/html/T_MimeKit_MimeMessage.htm) are all of type
[InternetAddressList](http://www.mimekit.net/docs/html/T_MimeKit_InternetAddressList.htm). An
The [From](https://www.mimekit.net/docs/html/P_MimeKit_MimeMessage_From.htm),
[To](https://www.mimekit.net/docs/html/P_MimeKit_MimeMessage_To.htm), and
[Cc](https://www.mimekit.net/docs/html/P_MimeKit_MimeMessage_Cc.htm) properties of a
[MimeMessage](https://www.mimekit.net/docs/html/T_MimeKit_MimeMessage.htm) are all of type
[InternetAddressList](https://www.mimekit.net/docs/html/T_MimeKit_InternetAddressList.htm). An
`InternetAddressList` is a list of
[InternetAddress](http://www.mimekit.net/docs/html/T_MimeKit_InternetAddress.htm) items. This is
[InternetAddress](https://www.mimekit.net/docs/html/T_MimeKit_InternetAddress.htm) items. This is
where most people start to get lost because an `InternetAddress` is an abstract class that only
really has a [Name](http://www.mimekit.net/docs/html/P_MimeKit_InternetAddress_Name.htm) property.
really has a [Name](https://www.mimekit.net/docs/html/P_MimeKit_InternetAddress_Name.htm) property.

As you've probably already discovered, the `Name` property contains the name of the person
(if available), but what you want is his or her email address, not their name.

To get the email address, you'll need to figure out what subclass of address each `InternetAddress`
really is. There are 2 subclasses of `InternetAddress`:
[GroupAddress](http://www.mimekit.net/docs/html/T_MimeKit_GroupAddress.htm) and
[MailboxAddress](http://www.mimekit.net/docs/html/T_MimeKit_MailboxAddress.htm).
[GroupAddress](https://www.mimekit.net/docs/html/T_MimeKit_GroupAddress.htm) and
[MailboxAddress](https://www.mimekit.net/docs/html/T_MimeKit_MailboxAddress.htm).

A `GroupAddress` is a named group of more `InternetAddress` items that are contained within the
[Members](http://www.mimekit.net/docs/html/P_MimeKit_GroupAddress_Members.htm) property. To get
[Members](https://www.mimekit.net/docs/html/P_MimeKit_GroupAddress_Members.htm) property. To get
an idea of what a group address represents, consider the following examples:

```
Expand All @@ -951,7 +951,7 @@ To: undisclosed-recipients:;

Most of the time, the `From`, `To`, and `Cc` headers will only contain mailbox addresses. As you will
notice, a `MailboxAddress` has an
[Address](http://www.mimekit.net/docs/html/P_MimeKit_MailboxAddress_Address.htm) property which will
[Address](https://www.mimekit.net/docs/html/P_MimeKit_MailboxAddress_Address.htm) property which will
contain the email address of the mailbox. In the following example, the `Address` property will
contain the value `john@smith.com`:

Expand Down Expand Up @@ -984,7 +984,7 @@ rfc2047 and until Outlook 2007, did not support filenames encoded using the mech

As of MimeKit v1.2.18, it is possible to configure MimeKit to use the rfc2047 encoding mechanism for
filenames (and other `Content-Disposition` and `Content-Type` parameter values) by setting the encoding
method on each individual [Parameter](http://www.mimekit.net/docs/html/T_MimeKit_Parameter.htm):
method on each individual [Parameter](https://www.mimekit.net/docs/html/T_MimeKit_Parameter.htm):

```csharp
Parameter param;
Expand All @@ -1008,7 +1008,7 @@ of the message rather than using the PGP/MIME format that MimeKit prefers.

These messages often look something like this:

```
```text
Return-Path: <pgp-enthusiast@example.com>
Received: from [127.0.0.1] (hostname.example.com. [201.95.8.17])
by mx.google.com with ESMTPSA id l67sm26628445yha.8.2014.04.27.13.49.44
Expand Down Expand Up @@ -1162,7 +1162,7 @@ body (assuming it has an HTML body) while still including the embedded images?
This gets a bit more complicated, but it's still doable...

The first thing we'd need to do is implement our own
[MimeVisitor](http://www.mimekit.net/docs/html/T_MimeKit_MimeVisitor.htm) to handle this:
[MimeVisitor](https://www.mimekit.net/docs/html/T_MimeKit_MimeVisitor.htm) to handle this:

```csharp
public class ReplyVisitor : MimeVisitor
Expand Down Expand Up @@ -1515,13 +1515,13 @@ Note: The above code snippet should be safe to call in .NET Framework versions >

### <a id="imap-unread-count">Q: How can I get the number of unread messages in a folder?</a>

If the folder is open (via [Open](http://www.mimekit.net/docs/html/Overload_MailKit_Net_Imap_ImapFolder_Open.htm)),
then the [ImapFolder.Unread](http://www.mimekit.net/docs/html/P_MailKit_MailFolder_Unread.htm) property will be kept
If the folder is open (via [Open](https://www.mimekit.net/docs/html/Overload_MailKit_Net_Imap_ImapFolder_Open.htm)),
then the [ImapFolder.Unread](https://www.mimekit.net/docs/html/P_MailKit_MailFolder_Unread.htm) property will be kept
up to date (at least as-of the latest command issued to the server).

If the folder *isn't* open, then you will need to query the unread state of the folder using the
[Status](http://www.mimekit.net/docs/html/M_MailKit_Net_Imap_ImapFolder_Status.htm) method with the
appropriate [StatusItems](http://www.mimekit.net/docs/html/T_MailKit_StatusItems.htm) flag(s).
[Status](https://www.mimekit.net/docs/html/M_MailKit_Net_Imap_ImapFolder_Status.htm) method with the
appropriate [StatusItems](https://www.mimekit.net/docs/html/T_MailKit_StatusItems.htm) flag(s).

For example, to get the total *and* unread counts, you can do this:

Expand Down Expand Up @@ -1557,8 +1557,8 @@ var results = folder.Search (query);

If you get an InvalidOperationException with the message, "The ImapClient is currently busy processing a
command.", it means that you are trying to use the
[ImapClient](http://www.mimekit.net/docs/html/T_MailKit_Net_Imap_ImapClient.htm) and/or one of its
[ImapFolder](http://www.mimekit.net/docs/html/T_MailKit_Net_Imap_ImapFolder.htm)s from multiple
[ImapClient](https://www.mimekit.net/docs/html/T_MailKit_Net_Imap_ImapClient.htm) and/or one of its
[ImapFolder](https://www.mimekit.net/docs/html/T_MailKit_Net_Imap_ImapFolder.htm)s from multiple
threads.

To avoid this situation, you'll need to lock the `SyncRoot` property of the `ImapClient` and `ImapFolder`
Expand All @@ -1579,8 +1579,8 @@ already do this locking for you.

If you get this exception, it's probably because you thought you had to open the destination folder that you
passed as an argument to one of the
[CopyTo](http://www.mimekit.net/docs/html/Overload_MailKit_MailFolder_CopyTo.htm) or
[MoveTo](http://www.mimekit.net/docs/html/Overload_MailKit_MailFolder_MoveTo.htm) methods. When you opened
[CopyTo](https://www.mimekit.net/docs/html/Overload_MailKit_MailFolder_CopyTo.htm) or
[MoveTo](https://www.mimekit.net/docs/html/Overload_MailKit_MailFolder_MoveTo.htm) methods. When you opened
that destination folder, you also inadvertently closed the source folder which is why you are getting this
exception.

Expand Down Expand Up @@ -1621,7 +1621,7 @@ The way to mark messages as read using the IMAP protocol is to set the `\Seen` f
To do this using MailKit, you will first need to know either the index(es) or the UID(s) of the messages
that you would like to set the `\Seen` flag on. Once you have that information, you will want to call
one of the
[AddFlags](http://www.mimekit.net/docs/html/Overload_MailKit_MailFolder_AddFlags.htm) methods on the
[AddFlags](https://www.mimekit.net/docs/html/Overload_MailKit_MailFolder_AddFlags.htm) methods on the
`ImapFolder`. For example:

```csharp
Expand Down Expand Up @@ -1881,7 +1881,7 @@ if (report != null && report.ReportType.Equals ("disposition-notification", Stri
The first part of the `multipart/report` will be a human-readable explanation of the notification.

The second part will have a MIME-type of `message/disposition-notification` and be represented by
a [MessageDispositionNotification](http://www.mimekit.net/docs/html/T_MimeKit_MessageDispositionNotification.htm).
a [MessageDispositionNotification](https://www.mimekit.net/docs/html/T_MimeKit_MessageDispositionNotification.htm).

This notification part will contain a list of header-like fields containing information about the
message that this notification is for such as the `Original-Message-Id`, `Original-Recipient`, etc.
Expand Down
Loading

0 comments on commit 2cda188

Please sign in to comment.