public sealed class GmailClient : IDisposable
Public NotInheritable Class GmailClient
Implements IDisposable
Dim instance As GmailClient
public ref class GmailClient sealed : IDisposable
[<SealedAttribute>]
type GmailClient =
class
interface IDisposable
end
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
Imports Google.Apis.Auth.OAuth2
Imports Google.Apis.Gmail.v1.Data
Dim client As New GmailClient("C:\GoogleSecrets.json", "yourmail@gmail.com", GmailScopes.ReadOnly Or GmailScopes.Modify Or GmailScopes.Send)
Dim credential As UserCredential = Await client.AuthorizeAsync()
Dim folder As Google.Apis.Gmail.v1.Data.Label = Await client.GetFolderAsyncByKnownId(GmailFolderIds.Inbox)
Dim messages As List(Of Google.Apis.Gmail.v1.Data.Message) = Await client.GetMessagesAsync(folder)
Dim msgCount As Integer
Dim [date] As String = ""
Dim from As String = ""
Dim subject As String = ""
Dim body As String = ""
For Each msg As Google.Apis.Gmail.v1.Data.Message In messages
For Each header As MessagePartHeader In msg.Payload.Headers
Select Case header.Name
Case "Date"
[date] = header.Value
Case "From"
from = header.Value
Case "Subject"
subject = header.Value
Case Else
' ...
End Select
Next header
Console.WriteLine(String.Format("Count: {0}; Id: {1}; From: {2}, Date: {3}, Subject: {4}",
Interlocked.Increment(msgCount),
msg.Id, from, [date], subject))
body = msg.Payload.Body.Data
' We need to evaluate this because some message bodies are Base64 encoded, and some others aren't.
If DevCase.Core.Cryptography.CryptoUtil.IsBase64Encoded(msg.Payload.Body.Data) Then
body = DevCase.Core.Cryptography.CryptoUtil.Base64Decode(msg.Payload.Body.Data)
End If
' Console.WriteLine(body)
Next msg
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
GmailClient(String, MailAddress, GmailScopes) | Initializes a new instance of the GmailClient class. |
GmailClient(String, String, GmailScopes) | Initializes a new instance of the GmailClient class. |
IsAuthorized | Gets a value that determines whether Gmail API authorization was done. |
MailAddress | Gets the mail address to authorize Gmail service. (e.g: "yourmail@gmail.com") |
Scope | Gets the current Gmail OAuthv2 scopes. |
Secrets | Gets the client credentials. |
Authorize | Authorizes this instance to use GMail API services. |
AuthorizeAsync | Authorizes this instance to use Gmail API services. |
DeleteMessage | Permanentlly deletes the specified message. |
DeleteMessageAsync | Asynchronously permanentlly deletes the specified message. |
Dispose | Releases all the resources used by this instance. |
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object) |
GetFolderAsyncByDisplayName | Asynchronously gets a mailbox folder that satisfies the specified display name. |
GetFolderAsyncById | Asynchronously gets a mailbox folder that satisfies the specified id. |
GetFolderAsyncByKnownId | Asynchronously gets a mailbox folder that satisfies the specified known Id. |
GetFolderByDisplayName | Gets a mailbox folder that satisfies the specified display name. |
GetFolderById | Gets a mailbox folder that satisfies the specified id. |
GetFolderByKnownId | Gets a mailbox folder that satisfies the specified known Id. |
GetHashCode | Serves as the default hash function. (Inherited from Object) |
GetMessages | Gets the messages contained in the specified mailbox folder. |
GetMessagesAsync | Asynchronously gets the messages contained in the specified mailbox folder. |
GetType | Gets the Type of the current instance. (Inherited from Object) |
RecycleMessage | Sends the specified message to the Trash folder. |
RecycleMessageAsync | Asynchronously sends the specified message to the Trash folder. |
SendMessageHtml(String, String, MailAddress) | Sends a mail with a HTML body. |
SendMessageHtml(String, String, MailAddressCollection) | Sends a mail with a HTML body. |
SendMessageHtml(String, String, String) | Sends a mail with a HTML body. |
SendMessageHtml(String, String, String) | Sends a mail with a HTML body. |
SendMessageHtml(String, String, MailAddress, ICollectionAttachment) | Sends a mail with a HTML body. |
SendMessageHtml(String, String, MailAddress, Attachment) | Sends a mail with a HTML body. |
SendMessageHtml(String, String, MailAddressCollection, ICollectionAttachment) | Sends a mail with a HTML body. |
SendMessageHtml(String, String, MailAddressCollection, Attachment) | Sends a mail with a HTML body. |
SendMessageHtml(String, String, String, ICollectionAttachment) | Sends a mail with a HTML body. |
SendMessageHtml(String, String, String, Attachment) | Sends a mail with a HTML body. |
SendMessageHtml(String, String, String, ICollectionAttachment) | Sends a mail with a HTML body. |
SendMessageHtml(String, String, String, Attachment) | Sends a mail with a HTML body. |
SendMessageHtmlAsync(String, String, MailAddress) | Asynchronously sends a mail with a HTML body. |
SendMessageHtmlAsync(String, String, MailAddressCollection) | Asynchronously sends a mail with a HTML body. |
SendMessageHtmlAsync(String, String, String) | Asynchronously sends a mail with a HTML body. |
SendMessageHtmlAsync(String, String, String) | Asynchronously sends a mail with a HTML body. |
SendMessageHtmlAsync(String, String, MailAddress, ICollectionAttachment) | Asynchronously sends a mail with a HTML body. |
SendMessageHtmlAsync(String, String, MailAddress, Attachment) | Asynchronously sends a mail with a HTML body. |
SendMessageHtmlAsync(String, String, MailAddressCollection, ICollectionAttachment) | Asynchronously sends a mail with a HTML body. |
SendMessageHtmlAsync(String, String, MailAddressCollection, Attachment) | Asynchronously sends a mail with a HTML body. |
SendMessageHtmlAsync(String, String, String, ICollectionAttachment) | Asynchronously sends a mail with a HTML body. |
SendMessageHtmlAsync(String, String, String, Attachment) | Asynchronously sends a mail with a HTML body. |
SendMessageHtmlAsync(String, String, String, ICollectionAttachment) | Asynchronously sends a mail with a HTML body. |
SendMessageHtmlAsync(String, String, String, Attachment) | Asynchronously sends a mail with a HTML body. |
SendMessageText(String, String, MailAddress) | Sends a mail with a plain text body. |
SendMessageText(String, String, MailAddressCollection) | Sends a mail with a plain text body. |
SendMessageText(String, String, String) | Sends a mail with a plain text body. |
SendMessageText(String, String, String) | Sends a mail with a plain text body. |
SendMessageText(String, String, MailAddress, ICollectionAttachment) | Sends a mail with a plain text body. |
SendMessageText(String, String, MailAddress, Attachment) | Sends a mail with a plain text body. |
SendMessageText(String, String, MailAddressCollection, ICollectionAttachment) | Sends a mail with a plain text body. |
SendMessageText(String, String, MailAddressCollection, Attachment) | Sends a mail with a plain text body. |
SendMessageText(String, String, String, ICollectionAttachment) | Sends a mail with a plain text body. |
SendMessageText(String, String, String, Attachment) | Sends a mail with a plain text body. |
SendMessageText(String, String, String, ICollectionAttachment) | Sends a mail with a plain text body. |
SendMessageText(String, String, String, Attachment) | Sends a mail with a plain text body. |
SendMessageTextAsync(String, String, MailAddress) | Asynchronously sends a mail with a plain text body. |
SendMessageTextAsync(String, String, MailAddressCollection) | Asynchronously sends a mail with a plain text body. |
SendMessageTextAsync(String, String, String) | Asynchronously sends a mail with a plain text body. |
SendMessageTextAsync(String, String, String) | Asynchronously sends a mail with a plain text body. |
SendMessageTextAsync(String, String, MailAddress, ICollectionAttachment) | Asynchronously sends a mail with a plain text body. |
SendMessageTextAsync(String, String, MailAddress, Attachment) | Asynchronously sends a mail with a plain text body. |
SendMessageTextAsync(String, String, MailAddressCollection, ICollectionAttachment) | Asynchronously sends a mail with a plain text body. |
SendMessageTextAsync(String, String, MailAddressCollection, Attachment) | Asynchronously sends a mail with a plain text body. |
SendMessageTextAsync(String, String, String, ICollectionAttachment) | Asynchronously sends a mail with a plain text body. |
SendMessageTextAsync(String, String, String, Attachment) | Asynchronously sends a mail with a plain text body. |
SendMessageTextAsync(String, String, String, ICollectionAttachment) | Asynchronously sends a mail with a plain text body. |
SendMessageTextAsync(String, String, String, Attachment) | Asynchronously sends a mail with a plain text body. |
ToString | Returns a string that represents the current object. (Inherited from Object) |
CanConvertTo |
Determines whether the source object can be converted to the specified target type.
(Defined by ObjectExtensions) |
CanConvertToT |
Determines whether the source object can be converted to the specified target type.
(Defined by ObjectExtensions) |
ConvertToT |
Converts an object to the specified target type.
If the conversion fails, an exception is thrown.
(Defined by ObjectExtensions) |
ConvertToT |
Converts an object to the specified target type.
If the conversion fails, returns the specified default value.
(Defined by ObjectExtensions) |
IsDisposable |
Determines whether the specified object is a disposable type
(i.e., it implements IDisposable interface).
(Defined by ObjectExtensions) |
Speak |
Speaks the string representation of the source object by using the
operating system integrated text-to-speech synthesizer.
(Defined by ObjectExtensions) |
Speak |
Speaks the string representation of the source object by using the
operating system integrated text-to-speech synthesizer.
(Defined by ObjectExtensions) |
ThrowIfNullTException |
Throws the specified exception if the source object is null.
(Defined by ObjectExtensions) |