Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ' ***********************************************************************
- ' Author : Elektro
- ' Modified : 12-December-2017
- ' ***********************************************************************
- #Region " Public Members Summary "
- #Region " Methods "
- ' SendGMailText(String, String, String, String, String)
- ' SendGMailText(String, String, String, String, String, Attachment())
- ' SendGMailText(String, String, String, String, String, Collection(Of Attachment))
- ' SendGMailText(String, String, String, String, MailAddress)
- ' SendGMailText(String, String, String, String, MailAddress, Attachment())
- ' SendGMailText(String, String, String, String, MailAddress, Collection(Of Attachment))
- ' SendGMailText(String, String, String, String, String())
- ' SendGMailText(String, String, String, String, String(), Attachment())
- ' SendGMailText(String, String, String, String, String(), Collection(Of Attachment))
- ' SendGMailText(String, String, String, String, MailAddressCollection)
- ' SendGMailText(String, String, String, String, MailAddressCollection, Attachment())
- ' SendGMailText(String, String, String, String, MailAddressCollection, Collection(Of Attachment))
- ' SendGMailText(NetworkCredential, String, String, String)
- ' SendGMailText(NetworkCredential, String, String, String, Attachment())
- ' SendGMailText(NetworkCredential, String, String, String, Collection(Of Attachment))
- ' SendGMailText(NetworkCredential, String, String, MailAddress)
- ' SendGMailText(NetworkCredential, String, String, MailAddress, Attachment())
- ' SendGMailText(NetworkCredential, String, String, MailAddress, Collection(Of Attachment))
- ' SendGMailText(NetworkCredential, String, String, String())
- ' SendGMailText(NetworkCredential, String, String, String(), Attachment())
- ' SendGMailText(NetworkCredential, String, String, String(), Collection(Of Attachment))
- ' SendGMailText(NetworkCredential, String, String, MailAddressCollection)
- ' SendGMailText(NetworkCredential, String, String, MailAddressCollection, Attachment())
- ' SendGMailText(NetworkCredential, String, String, MailAddressCollection, Collection(Of Attachment))
- ' SendGMailHtml(String, String, String, String, String)
- ' SendGMailHtml(String, String, String, String, String, Attachment())
- ' SendGMailHtml(String, String, String, String, String, Collection(Of Attachment))
- ' SendGMailHtml(String, String, String, String, MailAddress)
- ' SendGMailHtml(String, String, String, String, MailAddress, Attachment())
- ' SendGMailHtml(String, String, String, String, MailAddress, Collection(Of Attachment))
- ' SendGMailHtml(String, String, String, String, String())
- ' SendGMailHtml(String, String, String, String, String(), Attachment())
- ' SendGMailHtml(String, String, String, String, String(), Collection(Of Attachment))
- ' SendGMailHtml(String, String, String, String, MailAddressCollection)
- ' SendGMailHtml(String, String, String, String, MailAddressCollection, Attachment())
- ' SendGMailHtml(String, String, String, String, MailAddressCollection, Collection(Of Attachment))
- ' SendGMailHtml(NetworkCredential, String, String, String)
- ' SendGMailHtml(NetworkCredential, String, String, String, Attachment())
- ' SendGMailHtml(NetworkCredential, String, String, String, Collection(Of Attachment))
- ' SendGMailHtml(NetworkCredential, String, String, MailAddress)
- ' SendGMailHtml(NetworkCredential, String, String, MailAddress, Attachment())
- ' SendGMailHtml(NetworkCredential, String, String, MailAddress, Collection(Of Attachment))
- ' SendGMailHtml(NetworkCredential, String, String, String())
- ' SendGMailHtml(NetworkCredential, String, String, String(), Attachment())
- ' SendGMailHtml(NetworkCredential, String, String, String(), Collection(Of Attachment))
- ' SendGMailHtml(NetworkCredential, String, String, MailAddressCollection)
- ' SendGMailHtml(NetworkCredential, String, String, MailAddressCollection, Attachment())
- ' SendGMailHtml(NetworkCredential, String, String, MailAddressCollection, Collection(Of Attachment))
- #End Region
- #Region " Functions "
- ' SendGMailAsyncText(String, String, String, String, String) As Task
- ' SendGMailAsyncText(String, String, String, String, String Attachment()) As Task
- ' SendGMailAsyncText(String, String, String, String, String, Collection(Of Attachment)) As Task
- ' SendGMailAsyncText(String, String, String, String, MailAddress) As Task
- ' SendGMailAsyncText(String, String, String, String, MailAddress Attachment()) As Task
- ' SendGMailAsyncText(String, String, String, String, MailAddress, Collection(Of Attachment)) As Task
- ' SendGMailAsyncText(String, String, String, String, String()) As Task
- ' SendGMailAsyncText(String, String, String, String, String() Attachment()) As Task
- ' SendGMailAsyncText(String, String, String, String, String(), Collection(Of Attachment)) As Task
- ' SendGMailAsyncText(String, String, String, String, MailAddressCollection) As Task
- ' SendGMailAsyncText(String, String, String, String, MailAddressCollection Attachment()) As Task
- ' SendGMailAsyncText(String, String, String, String, MailAddressCollection, Collection(Of Attachment)) As Task
- ' SendGMailAsyncText(NetworkCredential, String, String, String) As Task
- ' SendGMailAsyncText(NetworkCredential, String, String, String Attachment()) As Task
- ' SendGMailAsyncText(NetworkCredential, String, String, String, Collection(Of Attachment)) As Task
- ' SendGMailAsyncText(NetworkCredential, String, String, MailAddress) As Task
- ' SendGMailAsyncText(NetworkCredential, String, String, MailAddress Attachment()) As Task
- ' SendGMailAsyncText(NetworkCredential, String, String, MailAddress, Collection(Of Attachment)) As Task
- ' SendGMailAsyncText(NetworkCredential, String, String, String()) As Task
- ' SendGMailAsyncText(NetworkCredential, String, String, String() Attachment()) As Task
- ' SendGMailAsyncText(NetworkCredential, String, String, String(), Collection(Of Attachment)) As Task
- ' SendGMailAsyncText(NetworkCredential, String, String, MailAddressCollection) As Task
- ' SendGMailAsyncText(NetworkCredential, String, String, MailAddressCollection Attachment()) As Task
- ' SendGMailAsyncText(NetworkCredential, String, String, MailAddressCollection, Collection(Of Attachment)) As Task
- ' SendGMailAsyncHtml(String, String, String, String, String) As Task
- ' SendGMailAsyncHtml(String, String, String, String, String Attachment()) As Task
- ' SendGMailAsyncHtml(String, String, String, String, String, Collection(Of Attachment)) As Task
- ' SendGMailAsyncHtml(String, String, String, String, MailAddress) As Task
- ' SendGMailAsyncHtml(String, String, String, String, MailAddress Attachment()) As Task
- ' SendGMailAsyncHtml(String, String, String, String, MailAddress, Collection(Of Attachment)) As Task
- ' SendGMailAsyncHtml(String, String, String, String, String()) As Task
- ' SendGMailAsyncHtml(String, String, String, String, String() Attachment()) As Task
- ' SendGMailAsyncHtml(String, String, String, String, String(), Collection(Of Attachment)) As Task
- ' SendGMailAsyncHtml(String, String, String, String, MailAddressCollection) As Task
- ' SendGMailAsyncHtml(String, String, String, String, MailAddressCollection Attachment()) As Task
- ' SendGMailAsyncHtml(String, String, String, String, MailAddressCollection, Collection(Of Attachment)) As Task
- ' SendGMailAsyncHtml(NetworkCredential, String, String, String) As Task
- ' SendGMailAsyncHtml(NetworkCredential, String, String, String Attachment()) As Task
- ' SendGMailAsyncHtml(NetworkCredential, String, String, String, Collection(Of Attachment)) As Task
- ' SendGMailAsyncHtml(NetworkCredential, String, String, MailAddress) As Task
- ' SendGMailAsyncHtml(NetworkCredential, String, String, MailAddress Attachment()) As Task
- ' SendGMailAsyncHtml(NetworkCredential, String, String, MailAddress, Collection(Of Attachment)) As Task
- ' SendGMailAsyncHtml(NetworkCredential, String, String, String()) As Task
- ' SendGMailAsyncHtml(NetworkCredential, String, String, String() Attachment()) As Task
- ' SendGMailAsyncHtml(NetworkCredential, String, String, String(), Collection(Of Attachment)) As Task
- ' SendGMailAsyncHtml(NetworkCredential, String, String, MailAddressCollection) As Task
- ' SendGMailAsyncHtml(NetworkCredential, String, String, MailAddressCollection Attachment()) As Task
- ' SendGMailAsyncHtml(NetworkCredential, String, String, MailAddressCollection, Collection(Of Attachment)) As Task
- #End Region
- #End Region
- #Region " Option Statements "
- Option Strict On
- Option Explicit On
- Option Infer Off
- #End Region
- #Region " Imports "
- Imports System.Collections.ObjectModel
- Imports System.Net
- Imports System.Net.Mail
- Imports System.Threading.Tasks
- 'Imports ElektroKit.Core.Types
- #End Region
- #Region " Mail Util "
- Namespace NET.Tools
- Partial Public NotInheritable Class MailUtil ': Inherits AestheticObject
- #Region " Public Methods "
- #Region " Text Body "
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Sends a mail with a plain text body through Google GMail SMTP server.
- ''' <para></para>
- ''' Note that in order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' SendGMailText("Username@Gmail.com", "Password", "Email Subject", "Message Body", "Address@Server.com")
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <remarks>
- ''' In order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </remarks>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="username">
- ''' The username of the Gmail account.
- ''' </param>
- '''
- ''' <param name="password">
- ''' The password of the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="address">
- ''' The target address that will receive our sent mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Sub SendGMailText(ByVal username As String,
- ByVal password As String,
- ByVal subject As String,
- ByVal body As String,
- ByVal address As String)
- MailUtil.SendGMailText(username, password, subject, body, {address})
- End Sub
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Sends a mail with a plain text body through Google GMail SMTP server.
- ''' <para></para>
- ''' Note that in order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' SendGMailText("Username@Gmail.com", "Password", "Email Subject", "Message Body", "Address@Server.com", New Attachment("C:\File.txt"))
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <remarks>
- ''' In order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </remarks>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="username">
- ''' The username of the Gmail account.
- ''' </param>
- '''
- ''' <param name="password">
- ''' The password of the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="address">
- ''' The target address that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Sub SendGMailText(ByVal username As String,
- ByVal password As String,
- ByVal subject As String,
- ByVal body As String,
- ByVal address As String,
- ParamArray attachments As Attachment())
- MailUtil.SendGMailText(username, password, subject, body, {address}, attachments)
- End Sub
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Sends a mail with a plain text body through Google GMail SMTP server.
- ''' <para></para>
- ''' Note that in order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim attachments As New Collection(Of Attachment) From {New Attachment("C:\File1.txt"), New Attachment("C:\File2.txt")}
- ''' SendGMailText("Username@Gmail.com", "Password", "Email Subject", "Message Body", "Address@Server.com", attachments)
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <remarks>
- ''' In order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </remarks>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="username">
- ''' The username of the Gmail account.
- ''' </param>
- '''
- ''' <param name="password">
- ''' The password of the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="address">
- ''' The target address that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Sub SendGMailText(ByVal username As String,
- ByVal password As String,
- ByVal subject As String,
- ByVal body As String,
- ByVal address As String,
- ByVal attachments As Collection(Of Attachment))
- MailUtil.SendGMailText(username, password, subject, body, {address}, attachments)
- End Sub
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Sends a mail with a plain text body through Google GMail SMTP server.
- ''' <para></para>
- ''' Note that in order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' SendGMailText("Username@Gmail.com", "Password", "Email Subject", "Message Body", New MailAddress("Address@Server.com"))
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <remarks>
- ''' In order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </remarks>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="username">
- ''' The username of the Gmail account.
- ''' </param>
- '''
- ''' <param name="password">
- ''' The password of the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="address">
- ''' The target address that will receive our sent mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Sub SendGMailText(ByVal username As String,
- ByVal password As String,
- ByVal subject As String,
- ByVal body As String,
- ByVal address As MailAddress)
- MailUtil.SendGMailText(username, password, subject, body, {address.Address})
- End Sub
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Sends a mail with a plain text body through Google GMail SMTP server.
- ''' <para></para>
- ''' Note that in order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' SendGMailText("Username@Gmail.com", "Password", "Email Subject", "Message Body", New MailAddress("Address@Server.com"), New Attachment("C:\File.txt"))
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <remarks>
- ''' In order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </remarks>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="username">
- ''' The username of the Gmail account.
- ''' </param>
- '''
- ''' <param name="password">
- ''' The password of the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="address">
- ''' The target address that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Sub SendGMailText(ByVal username As String,
- ByVal password As String,
- ByVal subject As String,
- ByVal body As String,
- ByVal address As MailAddress,
- ParamArray attachments As Attachment())
- MailUtil.SendGMailText(username, password, subject, body, {address.Address}, attachments)
- End Sub
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Sends a mail with a plain text body through Google GMail SMTP server.
- ''' <para></para>
- ''' Note that in order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim attachments As New Collection(Of Attachment) From {New Attachment("C:\File1.txt"), New Attachment("C:\File2.txt")}
- ''' SendGMailText("Username@Gmail.com", "Password", "Email Subject", "Message Body", New MailAddress("Address@Server.com"), attachments)
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <remarks>
- ''' In order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </remarks>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="username">
- ''' The username of the Gmail account.
- ''' </param>
- '''
- ''' <param name="password">
- ''' The password of the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="address">
- ''' The target address that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Sub SendGMailText(ByVal username As String,
- ByVal password As String,
- ByVal subject As String,
- ByVal body As String,
- ByVal address As MailAddress,
- ByVal attachments As Collection(Of Attachment))
- MailUtil.SendGMailText(username, password, subject, body, {address.Address}, attachments)
- End Sub
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Sends a mail with a plain text body through Google GMail SMTP server.
- ''' <para></para>
- ''' Note that in order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' SendGMailText("Username@Gmail.com", "Password", "Email Subject", "Message Body", {"Address1@Server.com", "Address2@Server.com"})
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <remarks>
- ''' In order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </remarks>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="username">
- ''' The username of the Gmail account.
- ''' </param>
- '''
- ''' <param name="password">
- ''' The password of the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="addresses">
- ''' The target addresses that will receive our sent mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Sub SendGMailText(ByVal username As String,
- ByVal password As String,
- ByVal subject As String,
- ByVal body As String,
- ByVal addresses As String())
- Dim addressCollection As New MailAddressCollection
- For Each address As String In addresses
- addressCollection.Add(New MailAddress(address))
- Next address
- MailUtil.SendGMailText(username, password, subject, body, addressCollection, attachments:=Nothing)
- End Sub
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Sends a mail with a plain text body through Google GMail SMTP server.
- ''' <para></para>
- ''' Note that in order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' SendGMailText("Username@Gmail.com", "Password", "Email Subject", "Message Body", {"Address1@Server.com", "Address2@Server.com"}, New Attachment("C:\File.txt"))
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <remarks>
- ''' In order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </remarks>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="username">
- ''' The username of the Gmail account.
- ''' </param>
- '''
- ''' <param name="password">
- ''' The password of the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="addresses">
- ''' The target addresses that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Sub SendGMailText(ByVal username As String,
- ByVal password As String,
- ByVal subject As String,
- ByVal body As String,
- ByVal addresses As String(),
- ParamArray attachments As Attachment())
- Dim addressCollection As New MailAddressCollection
- For Each address As String In addresses
- addressCollection.Add(New MailAddress(address))
- Next address
- MailUtil.SendGMailText(username, password, subject, body, addressCollection, attachments)
- End Sub
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Sends a mail with a plain text body through Google GMail SMTP server.
- ''' <para></para>
- ''' Note that in order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim attachments As New Collection(Of Attachment) From {New Attachment("C:\File1.txt"), New Attachment("C:\File2.txt")}
- ''' SendGMailText("Username@Gmail.com", "Password", "Email Subject", "Message Body", {"Address1@Server.com", "Address2@Server.com"}, attachments)
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <remarks>
- ''' In order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </remarks>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="username">
- ''' The username of the Gmail account.
- ''' </param>
- '''
- ''' <param name="password">
- ''' The password of the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="addresses">
- ''' The target addresses that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Sub SendGMailText(ByVal username As String,
- ByVal password As String,
- ByVal subject As String,
- ByVal body As String,
- ByVal addresses As String(),
- ByVal attachments As Collection(Of Attachment))
- Dim addressCollection As New MailAddressCollection
- For Each address As String In addresses
- addressCollection.Add(New MailAddress(address))
- Next address
- MailUtil.SendGMailText(username, password, subject, body, addressCollection, attachments)
- End Sub
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Sends a mail with a plain text body through Google GMail SMTP server.
- ''' <para></para>
- ''' Note that in order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim addressCollection As New MailAddressCollection
- ''' addressCollection.Add(New MailAddress("Address@Server.com"))
- ''' addressCollection.Add(New MailAddress("Address2@Server.com"))
- ''' SendGMailText("Username@Gmail.com", "Password", "Email Subject", "Message Body", addressCollection)
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <remarks>
- ''' In order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </remarks>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="username">
- ''' The username of the Gmail account.
- ''' </param>
- '''
- ''' <param name="password">
- ''' The password of the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="addresses">
- ''' The target addresses that will receive our sent mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Sub SendGMailText(ByVal username As String,
- ByVal password As String,
- ByVal subject As String,
- ByVal body As String,
- ByVal addresses As MailAddressCollection)
- MailUtil.SendGMailText(username, password, subject, body, addresses, attachments:=Nothing)
- End Sub
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Sends a mail with a plain text body through Google GMail SMTP server.
- ''' <para></para>
- ''' Note that in order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim addressCollection As New MailAddressCollection
- ''' addressCollection.Add(New MailAddress("Address@Server.com"))
- ''' addressCollection.Add(New MailAddress("Address2@Server.com"))
- ''' SendGMailText("Username@Gmail.com", "Password", "Email Subject", "Message Body", addressCollection, New Attachment("C:\File.txt"))
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <remarks>
- ''' In order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </remarks>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="username">
- ''' The username of the Gmail account.
- ''' </param>
- '''
- ''' <param name="password">
- ''' The password of the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="addresses">
- ''' The target addresses that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Sub SendGMailText(ByVal username As String,
- ByVal password As String,
- ByVal subject As String,
- ByVal body As String,
- ByVal addresses As MailAddressCollection,
- ParamArray attachments As Attachment())
- Dim attachCol As New Collection(Of Attachment)
- For Each attachment As Attachment In attachments
- attachCol.Add(attachment)
- Next attachment
- MailUtil.SendGMailText(username, password, subject, body, addresses, attachCol)
- End Sub
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Sends a mail with a plain text body through Google GMail SMTP server.
- ''' <para></para>
- ''' Note that in order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim addressCollection As New MailAddressCollection
- ''' addressCollection.Add(New MailAddress("Address@Server.com"))
- ''' addressCollection.Add(New MailAddress("Address2@Server.com"))
- '''
- ''' Dim attachments As New Collection(Of Attachment) From {New Attachment("C:\File1.txt"), New Attachment("C:\File2.txt")}
- '''
- ''' SendGMailText("Username@Gmail.com", "Password", "Email Subject", "Message Body", addressCollection, attachments)
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <remarks>
- ''' In order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </remarks>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="username">
- ''' The username of the Gmail account.
- ''' </param>
- '''
- ''' <param name="password">
- ''' The password of the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="addresses">
- ''' The target addresses that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Sub SendGMailText(ByVal username As String,
- ByVal password As String,
- ByVal subject As String,
- ByVal body As String,
- ByVal addresses As MailAddressCollection,
- ByVal attachments As Collection(Of Attachment))
- MailUtil.SendGMail(username, password, subject, body, addresses, attachments, isBodyHtml:=False)
- End Sub
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Sends a mail with a plain text body through Google GMail SMTP server.
- ''' <para></para>
- ''' Note that in order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim credential As New NetworkCredential("Username@Gmail.com", "Password")
- ''' SendGMailText(credential, "Email Subject", "Message Body", "Address@Server.com")
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <remarks>
- ''' In order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </remarks>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="credential">
- ''' The credential containing the username and password for the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="address">
- ''' The target address that will receive our sent mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Sub SendGMailText(ByVal credential As NetworkCredential,
- ByVal subject As String,
- ByVal body As String,
- ByVal address As String)
- MailUtil.SendGMailText(credential.UserName, credential.Password, subject, body, {address})
- End Sub
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Sends a mail with a plain text body through Google GMail SMTP server.
- ''' <para></para>
- ''' Note that in order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim credential As New NetworkCredential("Username@Gmail.com", "Password")
- ''' SendGMailText(credential, "Email Subject", "Message Body", "Address@Server.com", New Attachment("C:\File.txt"))
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <remarks>
- ''' In order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </remarks>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="credential">
- ''' The credential containing the username and password for the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="address">
- ''' The target address that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Sub SendGMailText(ByVal credential As NetworkCredential,
- ByVal subject As String,
- ByVal body As String,
- ByVal address As String,
- ParamArray attachments As Attachment())
- MailUtil.SendGMailText(credential.UserName, credential.Password, subject, body, {address}, attachments)
- End Sub
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Sends a mail with a plain text body through Google GMail SMTP server.
- ''' <para></para>
- ''' Note that in order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim credential As New NetworkCredential("Username@Gmail.com", "Password")
- ''' Dim attachments As New Collection(Of Attachment) From {New Attachment("C:\File1.txt"), New Attachment("C:\File2.txt")}
- ''' SendGMailText(credential, "Email Subject", "Message Body", "Address@Server.com", attachments)
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <remarks>
- ''' In order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </remarks>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="credential">
- ''' The credential containing the username and password for the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="address">
- ''' The target address that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Sub SendGMailText(ByVal credential As NetworkCredential,
- ByVal subject As String,
- ByVal body As String,
- ByVal address As String,
- ByVal attachments As Collection(Of Attachment))
- MailUtil.SendGMailText(credential.UserName, credential.Password, subject, body, {address}, attachments)
- End Sub
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Sends a mail with a plain text body through Google GMail SMTP server.
- ''' <para></para>
- ''' Note that in order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim credential As New NetworkCredential("Username@Gmail.com", "Password")
- ''' SendGMailText(credential, "Email Subject", "Message Body", New MailAddress("Address@Server.com"))
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <remarks>
- ''' In order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </remarks>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="credential">
- ''' The credential containing the username and password for the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="address">
- ''' The target address that will receive our sent mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Sub SendGMailText(ByVal credential As NetworkCredential,
- ByVal subject As String,
- ByVal body As String,
- ByVal address As MailAddress)
- MailUtil.SendGMailText(credential.UserName, credential.Password, subject, body, {address.Address})
- End Sub
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Sends a mail with a plain text body through Google GMail SMTP server.
- ''' <para></para>
- ''' Note that in order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim credential As New NetworkCredential("Username@Gmail.com", "Password")
- ''' SendGMailText(credential, "Email Subject", "Message Body", New MailAddress("Address@Server.com"), New Attachment("C:\File.txt"))
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <remarks>
- ''' In order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </remarks>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="credential">
- ''' The credential containing the username and password for the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="address">
- ''' The target address that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Sub SendGMailText(ByVal credential As NetworkCredential,
- ByVal subject As String,
- ByVal body As String,
- ByVal address As MailAddress,
- ParamArray attachments As Attachment())
- MailUtil.SendGMailText(credential.UserName, credential.Password, subject, body, {address.Address}, attachments)
- End Sub
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Sends a mail with a plain text body through Google GMail SMTP server.
- ''' <para></para>
- ''' Note that in order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim credential As New NetworkCredential("Username@Gmail.com", "Password")
- ''' Dim attachments As New Collection(Of Attachment) From {New Attachment("C:\File1.txt"), New Attachment("C:\File2.txt")}
- ''' SendGMailText(credential, "Email Subject", "Message Body", New MailAddress("Address@Server.com"), attachments)
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <remarks>
- ''' In order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </remarks>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="credential">
- ''' The credential containing the username and password for the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="address">
- ''' The target address that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Sub SendGMailText(ByVal credential As NetworkCredential,
- ByVal subject As String,
- ByVal body As String,
- ByVal address As MailAddress,
- ByVal attachments As Collection(Of Attachment))
- MailUtil.SendGMailText(credential.UserName, credential.Password, subject, body, {address.Address}, attachments)
- End Sub
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Sends a mail with a plain text body through Google GMail SMTP server.
- ''' <para></para>
- ''' Note that in order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim credential As New NetworkCredential("Username@Gmail.com", "Password")
- ''' SendGMailText(credential, "Email Subject", "Message Body", {"Address1@Server.com", "Address2@Server.com"})
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <remarks>
- ''' In order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </remarks>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="credential">
- ''' The credential containing the username and password for the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="addresses">
- ''' The target addresses that will receive our sent mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Sub SendGMailText(ByVal credential As NetworkCredential,
- ByVal subject As String,
- ByVal body As String,
- ByVal addresses As String())
- Dim addressCollection As New MailAddressCollection
- For Each address As String In addresses
- addressCollection.Add(New MailAddress(address))
- Next address
- MailUtil.SendGMailText(credential.UserName, credential.Password, subject, body, addressCollection, attachments:=Nothing)
- End Sub
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Sends a mail with a plain text body through Google GMail SMTP server.
- ''' <para></para>
- ''' Note that in order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim credential As New NetworkCredential("Username@Gmail.com", "Password")
- ''' SendGMailText(credential, "Email Subject", "Message Body", {"Address1@Server.com", "Address2@Server.com"}, New Attachment("C:\File.txt"))
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <remarks>
- ''' In order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </remarks>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="credential">
- ''' The credential containing the username and password for the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="addresses">
- ''' The target addresses that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Sub SendGMailText(ByVal credential As NetworkCredential,
- ByVal subject As String,
- ByVal body As String,
- ByVal addresses As String(),
- ParamArray attachments As Attachment())
- Dim addressCollection As New MailAddressCollection
- For Each address As String In addresses
- addressCollection.Add(New MailAddress(address))
- Next address
- MailUtil.SendGMailText(credential.UserName, credential.Password, subject, body, addressCollection, attachments)
- End Sub
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Sends a mail with a plain text body through Google GMail SMTP server.
- ''' <para></para>
- ''' Note that in order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim credential As New NetworkCredential("Username@Gmail.com", "Password")
- ''' Dim attachments As New Collection(Of Attachment) From {New Attachment("C:\File1.txt"), New Attachment("C:\File2.txt")}
- ''' SendGMailText(credential, "Email Subject", "Message Body", {"Address1@Server.com", "Address2@Server.com"}, attachments)
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <remarks>
- ''' In order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </remarks>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="credential">
- ''' The credential containing the username and password for the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="addresses">
- ''' The target addresses that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Sub SendGMailText(ByVal credential As NetworkCredential,
- ByVal subject As String,
- ByVal body As String,
- ByVal addresses As String(),
- ByVal attachments As Collection(Of Attachment))
- Dim addressCollection As New MailAddressCollection
- For Each address As String In addresses
- addressCollection.Add(New MailAddress(address))
- Next address
- MailUtil.SendGMailText(credential.UserName, credential.Password, subject, body, addressCollection, attachments)
- End Sub
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Sends a mail with a plain text body through Google GMail SMTP server.
- ''' <para></para>
- ''' Note that in order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim credential As New NetworkCredential("Username@Gmail.com", "Password")
- ''' Dim addressCollection As New MailAddressCollection
- ''' addressCollection.Add(New MailAddress("Address@Server.com"))
- ''' addressCollection.Add(New MailAddress("Address2@Server.com"))
- ''' SendGMailText(credential, "Email Subject", "Message Body", addressCollection)
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <remarks>
- ''' In order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </remarks>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="credential">
- ''' The credential containing the username and password for the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="addresses">
- ''' The target addresses that will receive our sent mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Sub SendGMailText(ByVal credential As NetworkCredential,
- ByVal subject As String,
- ByVal body As String,
- ByVal addresses As MailAddressCollection)
- MailUtil.SendGMailText(credential.UserName, credential.Password, subject, body, addresses, attachments:=Nothing)
- End Sub
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Sends a mail with a plain text body through Google GMail SMTP server.
- ''' <para></para>
- ''' Note that in order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim credential As New NetworkCredential("Username@Gmail.com", "Password")
- ''' Dim addressCollection As New MailAddressCollection
- ''' addressCollection.Add(New MailAddress("Address@Server.com"))
- ''' addressCollection.Add(New MailAddress("Address2@Server.com"))
- ''' SendGMailText(credential, "Email Subject", "Message Body", addressCollection, New Attachment("C:\File.txt"))
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <remarks>
- ''' In order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </remarks>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="credential">
- ''' The credential containing the username and password for the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="addresses">
- ''' The target addresses that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Sub SendGMailText(ByVal credential As NetworkCredential,
- ByVal subject As String,
- ByVal body As String,
- ByVal addresses As MailAddressCollection,
- ParamArray attachments As Attachment())
- Dim attachCol As New Collection(Of Attachment)
- For Each attachment As Attachment In attachments
- attachCol.Add(attachment)
- Next attachment
- MailUtil.SendGMailText(credential.UserName, credential.Password, subject, body, addresses, attachCol)
- End Sub
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Sends a mail with a plain text body through Google GMail SMTP server.
- ''' <para></para>
- ''' Note that in order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim credential As New NetworkCredential("Username@Gmail.com", "Password")
- ''' Dim addressCollection As New MailAddressCollection
- ''' addressCollection.Add(New MailAddress("Address@Server.com"))
- ''' addressCollection.Add(New MailAddress("Address2@Server.com"))
- '''
- ''' Dim attachments As New Collection(Of Attachment) From {New Attachment("C:\File1.txt"), New Attachment("C:\File2.txt")}
- '''
- ''' SendGMailText(credential, "Email Subject", "Message Body", addressCollection, attachments)
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <remarks>
- ''' In order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </remarks>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="credential">
- ''' The credential containing the username and password for the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="addresses">
- ''' The target addresses that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Sub SendGMailText(ByVal credential As NetworkCredential,
- ByVal subject As String,
- ByVal body As String,
- ByVal addresses As MailAddressCollection,
- ByVal attachments As Collection(Of Attachment))
- MailUtil.SendGMail(credential.UserName, credential.Password, subject, body, addresses, attachments, isBodyHtml:=False)
- End Sub
- #End Region
- #Region " HTML Body "
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Sends a mail with a HTML body through Google GMail SMTP server.
- ''' <para></para>
- ''' Note that in order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' SendGMailHtml("Username@Gmail.com", "Password", "Email Subject", "Message Body", "Address@Server.com")
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <remarks>
- ''' In order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </remarks>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="username">
- ''' The username of the Gmail account.
- ''' </param>
- '''
- ''' <param name="password">
- ''' The password of the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="address">
- ''' The target address that will receive our sent mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Sub SendGMailHtml(ByVal username As String,
- ByVal password As String,
- ByVal subject As String,
- ByVal body As String,
- ByVal address As String)
- MailUtil.SendGMailHtml(username, password, subject, body, {address})
- End Sub
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Sends a mail with a HTML body through Google GMail SMTP server.
- ''' <para></para>
- ''' Note that in order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' SendGMailHtml("Username@Gmail.com", "Password", "Email Subject", "Message Body", "Address@Server.com", New Attachment("C:\File.txt"))
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <remarks>
- ''' In order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </remarks>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="username">
- ''' The username of the Gmail account.
- ''' </param>
- '''
- ''' <param name="password">
- ''' The password of the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="address">
- ''' The target address that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Sub SendGMailHtml(ByVal username As String,
- ByVal password As String,
- ByVal subject As String,
- ByVal body As String,
- ByVal address As String,
- ParamArray attachments As Attachment())
- MailUtil.SendGMailHtml(username, password, subject, body, {address}, attachments)
- End Sub
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Sends a mail with a HTML body through Google GMail SMTP server.
- ''' <para></para>
- ''' Note that in order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim attachments As New Collection(Of Attachment) From {New Attachment("C:\File1.txt"), New Attachment("C:\File2.txt")}
- ''' SendGMailHtml("Username@Gmail.com", "Password", "Email Subject", "Message Body", "Address@Server.com", attachments)
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <remarks>
- ''' In order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </remarks>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="username">
- ''' The username of the Gmail account.
- ''' </param>
- '''
- ''' <param name="password">
- ''' The password of the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="address">
- ''' The target address that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Sub SendGMailHtml(ByVal username As String,
- ByVal password As String,
- ByVal subject As String,
- ByVal body As String,
- ByVal address As String,
- ByVal attachments As Collection(Of Attachment))
- MailUtil.SendGMailHtml(username, password, subject, body, {address}, attachments)
- End Sub
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Sends a mail with a HTML body through Google GMail SMTP server.
- ''' <para></para>
- ''' Note that in order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' SendGMailHtml("Username@Gmail.com", "Password", "Email Subject", "Message Body", New MailAddress("Address@Server.com"))
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <remarks>
- ''' In order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </remarks>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="username">
- ''' The username of the Gmail account.
- ''' </param>
- '''
- ''' <param name="password">
- ''' The password of the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="address">
- ''' The target address that will receive our sent mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Sub SendGMailHtml(ByVal username As String,
- ByVal password As String,
- ByVal subject As String,
- ByVal body As String,
- ByVal address As MailAddress)
- MailUtil.SendGMailHtml(username, password, subject, body, {address.Address})
- End Sub
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Sends a mail with a HTML body through Google GMail SMTP server.
- ''' <para></para>
- ''' Note that in order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' SendGMailHtml("Username@Gmail.com", "Password", "Email Subject", "Message Body", New MailAddress("Address@Server.com"), New Attachment("C:\File.txt"))
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <remarks>
- ''' In order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </remarks>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="username">
- ''' The username of the Gmail account.
- ''' </param>
- '''
- ''' <param name="password">
- ''' The password of the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="address">
- ''' The target address that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Sub SendGMailHtml(ByVal username As String,
- ByVal password As String,
- ByVal subject As String,
- ByVal body As String,
- ByVal address As MailAddress,
- ParamArray attachments As Attachment())
- MailUtil.SendGMailHtml(username, password, subject, body, {address.Address}, attachments)
- End Sub
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Sends a mail with a HTML body through Google GMail SMTP server.
- ''' <para></para>
- ''' Note that in order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim attachments As New Collection(Of Attachment) From {New Attachment("C:\File1.txt"), New Attachment("C:\File2.txt")}
- ''' SendGMailHtml("Username@Gmail.com", "Password", "Email Subject", "Message Body", New MailAddress("Address@Server.com"), attachments)
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <remarks>
- ''' In order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </remarks>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="username">
- ''' The username of the Gmail account.
- ''' </param>
- '''
- ''' <param name="password">
- ''' The password of the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="address">
- ''' The target address that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Sub SendGMailHtml(ByVal username As String,
- ByVal password As String,
- ByVal subject As String,
- ByVal body As String,
- ByVal address As MailAddress,
- ByVal attachments As Collection(Of Attachment))
- MailUtil.SendGMailHtml(username, password, subject, body, {address.Address}, attachments)
- End Sub
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Sends a mail with a HTML body through Google GMail SMTP server.
- ''' <para></para>
- ''' Note that in order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' SendGMailHtml("Username@Gmail.com", "Password", "Email Subject", "Message Body", {"Address1@Server.com", "Address2@Server.com"})
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <remarks>
- ''' In order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </remarks>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="username">
- ''' The username of the Gmail account.
- ''' </param>
- '''
- ''' <param name="password">
- ''' The password of the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="addresses">
- ''' The target addresses that will receive our sent mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Sub SendGMailHtml(ByVal username As String,
- ByVal password As String,
- ByVal subject As String,
- ByVal body As String,
- ByVal addresses As String())
- Dim addressCollection As New MailAddressCollection
- For Each address As String In addresses
- addressCollection.Add(New MailAddress(address))
- Next address
- MailUtil.SendGMailHtml(username, password, subject, body, addressCollection, attachments:=Nothing)
- End Sub
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Sends a mail with a HTML body through Google GMail SMTP server.
- ''' <para></para>
- ''' Note that in order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' SendGMailHtml("Username@Gmail.com", "Password", "Email Subject", "Message Body", {"Address1@Server.com", "Address2@Server.com"}, New Attachment("C:\File.txt"))
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <remarks>
- ''' In order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </remarks>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="username">
- ''' The username of the Gmail account.
- ''' </param>
- '''
- ''' <param name="password">
- ''' The password of the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="addresses">
- ''' The target addresses that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Sub SendGMailHtml(ByVal username As String,
- ByVal password As String,
- ByVal subject As String,
- ByVal body As String,
- ByVal addresses As String(),
- ParamArray attachments As Attachment())
- Dim addressCollection As New MailAddressCollection
- For Each address As String In addresses
- addressCollection.Add(New MailAddress(address))
- Next address
- MailUtil.SendGMailHtml(username, password, subject, body, addressCollection, attachments)
- End Sub
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Sends a mail with a HTML body through Google GMail SMTP server.
- ''' <para></para>
- ''' Note that in order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim attachments As New Collection(Of Attachment) From {New Attachment("C:\File1.txt"), New Attachment("C:\File2.txt")}
- ''' SendGMailHtml("Username@Gmail.com", "Password", "Email Subject", "Message Body", {"Address1@Server.com", "Address2@Server.com"}, attachments)
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <remarks>
- ''' In order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </remarks>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="username">
- ''' The username of the Gmail account.
- ''' </param>
- '''
- ''' <param name="password">
- ''' The password of the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="addresses">
- ''' The target addresses that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Sub SendGMailHtml(ByVal username As String,
- ByVal password As String,
- ByVal subject As String,
- ByVal body As String,
- ByVal addresses As String(),
- ByVal attachments As Collection(Of Attachment))
- Dim addressCollection As New MailAddressCollection
- For Each address As String In addresses
- addressCollection.Add(New MailAddress(address))
- Next address
- MailUtil.SendGMailHtml(username, password, subject, body, addressCollection, attachments)
- End Sub
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Sends a mail with a HTML body through Google GMail SMTP server.
- ''' <para></para>
- ''' Note that in order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim addressCollection As New MailAddressCollection
- ''' addressCollection.Add(New MailAddress("Address@Server.com"))
- ''' addressCollection.Add(New MailAddress("Address2@Server.com"))
- ''' SendGMailHtml("Username@Gmail.com", "Password", "Email Subject", "Message Body", addressCollection)
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <remarks>
- ''' In order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </remarks>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="username">
- ''' The username of the Gmail account.
- ''' </param>
- '''
- ''' <param name="password">
- ''' The password of the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="addresses">
- ''' The target addresses that will receive our sent mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Sub SendGMailHtml(ByVal username As String,
- ByVal password As String,
- ByVal subject As String,
- ByVal body As String,
- ByVal addresses As MailAddressCollection)
- MailUtil.SendGMailHtml(username, password, subject, body, addresses, attachments:=Nothing)
- End Sub
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Sends a mail with a HTML body through Google GMail SMTP server.
- ''' <para></para>
- ''' Note that in order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim addressCollection As New MailAddressCollection
- ''' addressCollection.Add(New MailAddress("Address@Server.com"))
- ''' addressCollection.Add(New MailAddress("Address2@Server.com"))
- ''' SendGMailHtml("Username@Gmail.com", "Password", "Email Subject", "Message Body", addressCollection, New Attachment("C:\File.txt"))
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <remarks>
- ''' In order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </remarks>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="username">
- ''' The username of the Gmail account.
- ''' </param>
- '''
- ''' <param name="password">
- ''' The password of the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="addresses">
- ''' The target addresses that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Sub SendGMailHtml(ByVal username As String,
- ByVal password As String,
- ByVal subject As String,
- ByVal body As String,
- ByVal addresses As MailAddressCollection,
- ParamArray attachments As Attachment())
- Dim attachCol As New Collection(Of Attachment)
- For Each attachment As Attachment In attachments
- attachCol.Add(attachment)
- Next attachment
- MailUtil.SendGMailHtml(username, password, subject, body, addresses, attachCol)
- End Sub
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Sends a mail with a HTML body through Google GMail SMTP server.
- ''' <para></para>
- ''' Note that in order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim addressCollection As New MailAddressCollection
- ''' addressCollection.Add(New MailAddress("Address@Server.com"))
- ''' addressCollection.Add(New MailAddress("Address2@Server.com"))
- '''
- ''' Dim attachments As New Collection(Of Attachment) From {New Attachment("C:\File1.txt"), New Attachment("C:\File2.txt")}
- '''
- ''' SendGMailHtml("Username@Gmail.com", "Password", "Email Subject", "Message Body", addressCollection, attachments)
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <remarks>
- ''' In order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </remarks>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="username">
- ''' The username of the Gmail account.
- ''' </param>
- '''
- ''' <param name="password">
- ''' The password of the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="addresses">
- ''' The target addresses that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Sub SendGMailHtml(ByVal username As String,
- ByVal password As String,
- ByVal subject As String,
- ByVal body As String,
- ByVal addresses As MailAddressCollection,
- ByVal attachments As Collection(Of Attachment))
- MailUtil.SendGMail(username, password, subject, body, addresses, attachments, isBodyHtml:=True)
- End Sub
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Sends a mail with a HTML body through Google GMail SMTP server.
- ''' <para></para>
- ''' Note that in order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim credential As New NetworkCredential("Username@Gmail.com", "Password")
- ''' SendGMailHtml(credential, "Email Subject", "Message Body", "Address@Server.com")
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <remarks>
- ''' In order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </remarks>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="credential">
- ''' The credential containing the username and password for the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="address">
- ''' The target address that will receive our sent mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Sub SendGMailHtml(ByVal credential As NetworkCredential,
- ByVal subject As String,
- ByVal body As String,
- ByVal address As String)
- MailUtil.SendGMailHtml(credential.UserName, credential.Password, subject, body, {address})
- End Sub
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Sends a mail with a HTML body through Google GMail SMTP server.
- ''' <para></para>
- ''' Note that in order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim credential As New NetworkCredential("Username@Gmail.com", "Password")
- ''' SendGMailHtml(credential, "Email Subject", "Message Body", "Address@Server.com", New Attachment("C:\File.txt"))
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <remarks>
- ''' In order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </remarks>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="credential">
- ''' The credential containing the username and password for the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="address">
- ''' The target address that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Sub SendGMailHtml(ByVal credential As NetworkCredential,
- ByVal subject As String,
- ByVal body As String,
- ByVal address As String,
- ParamArray attachments As Attachment())
- MailUtil.SendGMailHtml(credential.UserName, credential.Password, subject, body, {address}, attachments)
- End Sub
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Sends a mail with a HTML body through Google GMail SMTP server.
- ''' <para></para>
- ''' Note that in order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim credential As New NetworkCredential("Username@Gmail.com", "Password")
- ''' Dim attachments As New Collection(Of Attachment) From {New Attachment("C:\File1.txt"), New Attachment("C:\File2.txt")}
- ''' SendGMailHtml(credential, "Email Subject", "Message Body", "Address@Server.com", attachments)
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <remarks>
- ''' In order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </remarks>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="credential">
- ''' The credential containing the username and password for the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="address">
- ''' The target address that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Sub SendGMailHtml(ByVal credential As NetworkCredential,
- ByVal subject As String,
- ByVal body As String,
- ByVal address As String,
- ByVal attachments As Collection(Of Attachment))
- MailUtil.SendGMailHtml(credential.UserName, credential.Password, subject, body, {address}, attachments)
- End Sub
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Sends a mail with a HTML body through Google GMail SMTP server.
- ''' <para></para>
- ''' Note that in order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim credential As New NetworkCredential("Username@Gmail.com", "Password")
- ''' SendGMailHtml(credential, "Email Subject", "Message Body", New MailAddress("Address@Server.com"))
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <remarks>
- ''' In order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </remarks>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="credential">
- ''' The credential containing the username and password for the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="address">
- ''' The target address that will receive our sent mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Sub SendGMailHtml(ByVal credential As NetworkCredential,
- ByVal subject As String,
- ByVal body As String,
- ByVal address As MailAddress)
- MailUtil.SendGMailHtml(credential.UserName, credential.Password, subject, body, {address.Address})
- End Sub
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Sends a mail with a HTML body through Google GMail SMTP server.
- ''' <para></para>
- ''' Note that in order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim credential As New NetworkCredential("Username@Gmail.com", "Password")
- ''' SendGMailHtml(credential, "Email Subject", "Message Body", New MailAddress("Address@Server.com"), New Attachment("C:\File.txt"))
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <remarks>
- ''' In order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </remarks>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="credential">
- ''' The credential containing the username and password for the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="address">
- ''' The target address that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Sub SendGMailHtml(ByVal credential As NetworkCredential,
- ByVal subject As String,
- ByVal body As String,
- ByVal address As MailAddress,
- ParamArray attachments As Attachment())
- MailUtil.SendGMailHtml(credential.UserName, credential.Password, subject, body, {address.Address}, attachments)
- End Sub
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Sends a mail with a HTML body through Google GMail SMTP server.
- ''' <para></para>
- ''' Note that in order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim credential As New NetworkCredential("Username@Gmail.com", "Password")
- ''' Dim attachments As New Collection(Of Attachment) From {New Attachment("C:\File1.txt"), New Attachment("C:\File2.txt")}
- ''' SendGMailHtml(credential, "Email Subject", "Message Body", New MailAddress("Address@Server.com"), attachments)
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <remarks>
- ''' In order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </remarks>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="credential">
- ''' The credential containing the username and password for the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="address">
- ''' The target address that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Sub SendGMailHtml(ByVal credential As NetworkCredential,
- ByVal subject As String,
- ByVal body As String,
- ByVal address As MailAddress,
- ByVal attachments As Collection(Of Attachment))
- MailUtil.SendGMailHtml(credential.UserName, credential.Password, subject, body, {address.Address}, attachments)
- End Sub
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Sends a mail with a HTML body through Google GMail SMTP server.
- ''' <para></para>
- ''' Note that in order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim credential As New NetworkCredential("Username@Gmail.com", "Password")
- ''' SendGMailHtml(credential, "Email Subject", "Message Body", {"Address1@Server.com", "Address2@Server.com"})
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <remarks>
- ''' In order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </remarks>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="credential">
- ''' The credential containing the username and password for the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="addresses">
- ''' The target addresses that will receive our sent mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Sub SendGMailHtml(ByVal credential As NetworkCredential,
- ByVal subject As String,
- ByVal body As String,
- ByVal addresses As String())
- Dim addressCollection As New MailAddressCollection
- For Each address As String In addresses
- addressCollection.Add(New MailAddress(address))
- Next address
- MailUtil.SendGMailHtml(credential.UserName, credential.Password, subject, body, addressCollection, attachments:=Nothing)
- End Sub
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Sends a mail with a HTML body through Google GMail SMTP server.
- ''' <para></para>
- ''' Note that in order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim credential As New NetworkCredential("Username@Gmail.com", "Password")
- ''' SendGMailHtml(credential, "Email Subject", "Message Body", {"Address1@Server.com", "Address2@Server.com"}, New Attachment("C:\File.txt"))
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <remarks>
- ''' In order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </remarks>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="credential">
- ''' The credential containing the username and password for the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="addresses">
- ''' The target addresses that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Sub SendGMailHtml(ByVal credential As NetworkCredential,
- ByVal subject As String,
- ByVal body As String,
- ByVal addresses As String(),
- ParamArray attachments As Attachment())
- Dim addressCollection As New MailAddressCollection
- For Each address As String In addresses
- addressCollection.Add(New MailAddress(address))
- Next address
- MailUtil.SendGMailHtml(credential.UserName, credential.Password, subject, body, addressCollection, attachments)
- End Sub
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Sends a mail with a HTML body through Google GMail SMTP server.
- ''' <para></para>
- ''' Note that in order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim credential As New NetworkCredential("Username@Gmail.com", "Password")
- ''' Dim attachments As New Collection(Of Attachment) From {New Attachment("C:\File1.txt"), New Attachment("C:\File2.txt")}
- ''' SendGMailHtml(credential, "Email Subject", "Message Body", {"Address1@Server.com", "Address2@Server.com"}, attachments)
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <remarks>
- ''' In order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </remarks>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="credential">
- ''' The credential containing the username and password for the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="addresses">
- ''' The target addresses that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Sub SendGMailHtml(ByVal credential As NetworkCredential,
- ByVal subject As String,
- ByVal body As String,
- ByVal addresses As String(),
- ByVal attachments As Collection(Of Attachment))
- Dim addressCollection As New MailAddressCollection
- For Each address As String In addresses
- addressCollection.Add(New MailAddress(address))
- Next address
- MailUtil.SendGMailHtml(credential.UserName, credential.Password, subject, body, addressCollection, attachments)
- End Sub
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Sends a mail with a HTML body through Google GMail SMTP server.
- ''' <para></para>
- ''' Note that in order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim credential As New NetworkCredential("Username@Gmail.com", "Password")
- ''' Dim addressCollection As New MailAddressCollection
- ''' addressCollection.Add(New MailAddress("Address@Server.com"))
- ''' addressCollection.Add(New MailAddress("Address2@Server.com"))
- ''' SendGMailHtml(credential, "Email Subject", "Message Body", addressCollection)
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <remarks>
- ''' In order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </remarks>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="credential">
- ''' The credential containing the username and password for the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="addresses">
- ''' The target addresses that will receive our sent mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Sub SendGMailHtml(ByVal credential As NetworkCredential,
- ByVal subject As String,
- ByVal body As String,
- ByVal addresses As MailAddressCollection)
- MailUtil.SendGMailHtml(credential.UserName, credential.Password, subject, body, addresses, attachments:=Nothing)
- End Sub
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Sends a mail with a HTML body through Google GMail SMTP server.
- ''' <para></para>
- ''' Note that in order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim credential As New NetworkCredential("Username@Gmail.com", "Password")
- ''' Dim addressCollection As New MailAddressCollection
- ''' addressCollection.Add(New MailAddress("Address@Server.com"))
- ''' addressCollection.Add(New MailAddress("Address2@Server.com"))
- ''' SendGMailHtml(credential, "Email Subject", "Message Body", addressCollection, New Attachment("C:\File.txt"))
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <remarks>
- ''' In order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </remarks>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="credential">
- ''' The credential containing the username and password for the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="addresses">
- ''' The target addresses that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Sub SendGMailHtml(ByVal credential As NetworkCredential,
- ByVal subject As String,
- ByVal body As String,
- ByVal addresses As MailAddressCollection,
- ParamArray attachments As Attachment())
- Dim attachCol As New Collection(Of Attachment)
- For Each attachment As Attachment In attachments
- attachCol.Add(attachment)
- Next attachment
- MailUtil.SendGMailHtml(credential.UserName, credential.Password, subject, body, addresses, attachCol)
- End Sub
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Sends a mail with a HTML body through Google GMail SMTP server.
- ''' <para></para>
- ''' Note that in order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim credential As New NetworkCredential("Username@Gmail.com", "Password")
- ''' Dim addressCollection As New MailAddressCollection
- ''' addressCollection.Add(New MailAddress("Address@Server.com"))
- ''' addressCollection.Add(New MailAddress("Address2@Server.com"))
- '''
- ''' Dim attachments As New Collection(Of Attachment) From {New Attachment("C:\File1.txt"), New Attachment("C:\File2.txt")}
- '''
- ''' SendGMailHtml(credential, "Email Subject", "Message Body", addressCollection, attachments)
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <remarks>
- ''' In order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </remarks>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="credential">
- ''' The credential containing the username and password for the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="addresses">
- ''' The target addresses that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Sub SendGMailHtml(ByVal credential As NetworkCredential,
- ByVal subject As String,
- ByVal body As String,
- ByVal addresses As MailAddressCollection,
- ByVal attachments As Collection(Of Attachment))
- MailUtil.SendGMail(credential.UserName, credential.Password, subject, body, addresses, attachments, isBodyHtml:=True)
- End Sub
- #End Region
- #If NET45 OrElse NET46 Then
- #Region " (ASYNC) Text Body "
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Asynchronously sends a mail with a plain text body through Google GMail SMTP server.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Await SendGMailAsyncText("Username@GMail.com", "Password", "Email Subject", "Message Body", "Address@Server.com")
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="username">
- ''' The username of the Gmail account.
- ''' </param>
- '''
- ''' <param name="password">
- ''' The password of the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="address">
- ''' The target address that will receive our sent mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Async Function SendGMailAsyncText(ByVal username As String,
- ByVal password As String,
- ByVal subject As String,
- ByVal body As String,
- ByVal address As String) As Task
- Await MailUtil.SendGMailAsyncText(username, password, subject, body, {address})
- End Function
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Asynchronously sends a mail with a plain text body through Google GMail SMTP server.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Await SendGMailAsyncText("Username@GMail.com", "Password", "Email Subject", "Message Body", "Address@Server.com", New Attachment("C:\File.txt"))
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="username">
- ''' The username of the Gmail account.
- ''' </param>
- '''
- ''' <param name="password">
- ''' The password of the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="address">
- ''' The target address that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Async Function SendGMailAsyncText(ByVal username As String,
- ByVal password As String,
- ByVal subject As String,
- ByVal body As String,
- ByVal address As String,
- ParamArray attachments As Attachment()) As Task
- Await MailUtil.SendGMailAsyncText(username, password, subject, body, {address}, attachments)
- End Function
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Asynchronously sends a mail with a plain text body through Google GMail SMTP server.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim attachments As New Collection(Of Attachment) From {New Attachment("C:\File1.txt"), New Attachment("C:\File2.txt")}
- ''' Await SendGMailAsyncText("Username@GMail.com", "Password", "Email Subject", "Message Body", "Address@Server.com", attachments)
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="username">
- ''' The username of the Gmail account.
- ''' </param>
- '''
- ''' <param name="password">
- ''' The password of the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="address">
- ''' The target address that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Async Function SendGMailAsyncText(ByVal username As String,
- ByVal password As String,
- ByVal subject As String,
- ByVal body As String,
- ByVal address As String,
- ByVal attachments As Collection(Of Attachment)) As Task
- Await MailUtil.SendGMailAsyncText(username, password, subject, body, {address}, attachments)
- End Function
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Asynchronously sends a mail with a plain text body through Google GMail SMTP server.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Await SendGMailAsyncText("Username@GMail.com", "Password", "Email Subject", "Message Body", New MailAddress("Address@Server.com"))
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="username">
- ''' The username of the Gmail account.
- ''' </param>
- '''
- ''' <param name="password">
- ''' The password of the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="address">
- ''' The target address that will receive our sent mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Async Function SendGMailAsyncText(ByVal username As String,
- ByVal password As String,
- ByVal subject As String,
- ByVal body As String,
- ByVal address As MailAddress) As Task
- Await MailUtil.SendGMailAsyncText(username, password, subject, body, {address.Address})
- End Function
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Asynchronously sends a mail with a plain text body through Google GMail SMTP server.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Await SendGMailAsyncText("Username@GMail.com", "Password", "Email Subject", "Message Body", New MailAddress("Address@Server.com"), New Attachment("C:\File.txt"))
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="username">
- ''' The username of the Gmail account.
- ''' </param>
- '''
- ''' <param name="password">
- ''' The password of the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="address">
- ''' The target address that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Async Function SendGMailAsyncText(ByVal username As String,
- ByVal password As String,
- ByVal subject As String,
- ByVal body As String,
- ByVal address As MailAddress,
- ParamArray attachments As Attachment()) As Task
- Await MailUtil.SendGMailAsyncText(username, password, subject, body, {address.Address}, attachments)
- End Function
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Asynchronously sends a mail with a plain text body through Google GMail SMTP server.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim attachments As New Collection(Of Attachment) From {New Attachment("C:\File1.txt"), New Attachment("C:\File2.txt")}
- ''' Await SendGMailAsyncText("Username@GMail.com", "Password", "Email Subject", "Message Body", New MailAddress("Address@Server.com"), attachments)
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="username">
- ''' The username of the Gmail account.
- ''' </param>
- '''
- ''' <param name="password">
- ''' The password of the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="address">
- ''' The target address that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Async Function SendGMailAsyncText(ByVal username As String,
- ByVal password As String,
- ByVal subject As String,
- ByVal body As String,
- ByVal address As MailAddress,
- ByVal attachments As Collection(Of Attachment)) As Task
- Await MailUtil.SendGMailAsyncText(username, password, subject, body, {address.Address}, attachments)
- End Function
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Asynchronously sends a mail with a plain text body through Google GMail SMTP server.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Await SendGMailAsyncText("Username@GMail.com", "Password", "Email Subject", "Message Body", {"Address1@Server.com", "Address2@Server.com"})
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="username">
- ''' The username of the Gmail account.
- ''' </param>
- '''
- ''' <param name="password">
- ''' The password of the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="addresses">
- ''' The target addresses that will receive our sent mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Async Function SendGMailAsyncText(ByVal username As String,
- ByVal password As String,
- ByVal subject As String,
- ByVal body As String,
- ByVal addresses As String()) As Task
- Dim addressCollection As New MailAddressCollection
- For Each address As String In addresses
- addressCollection.Add(New MailAddress(address))
- Next address
- Await MailUtil.SendGMailAsyncText(username, password, subject, body, addressCollection)
- End Function
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Asynchronously sends a mail with a plain text body through Google GMail SMTP server.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Await SendGMailAsyncText("Username@GMail.com", "Password", "Email Subject", "Message Body", {"Address1@Server.com", "Address2@Server.com"}, New Attachment("C:\File.txt"))
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="username">
- ''' The username of the Gmail account.
- ''' </param>
- '''
- ''' <param name="password">
- ''' The password of the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="addresses">
- ''' The target addresses that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Async Function SendGMailAsyncText(ByVal username As String,
- ByVal password As String,
- ByVal subject As String,
- ByVal body As String,
- ByVal addresses As String(),
- ParamArray attachments As Attachment()) As Task
- Dim addressCollection As New MailAddressCollection
- For Each address As String In addresses
- addressCollection.Add(New MailAddress(address))
- Next address
- Await MailUtil.SendGMailAsyncText(username, password, subject, body, addressCollection, attachments)
- End Function
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Asynchronously sends a mail with a plain text body through Google GMail SMTP server.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim attachments As New Collection(Of Attachment) From {New Attachment("C:\File1.txt"), New Attachment("C:\File2.txt")}
- ''' Await SendGMailAsyncText("Username@GMail.com", "Password", "Email Subject", "Message Body", {"Address1@Server.com", "Address2@Server.com"}, attachments)
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="username">
- ''' The username of the Gmail account.
- ''' </param>
- '''
- ''' <param name="password">
- ''' The password of the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="addresses">
- ''' The target addresses that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Async Function SendGMailAsyncText(ByVal username As String,
- ByVal password As String,
- ByVal subject As String,
- ByVal body As String,
- ByVal addresses As String(),
- ByVal attachments As Collection(Of Attachment)) As Task
- Dim addressCollection As New MailAddressCollection
- For Each address As String In addresses
- addressCollection.Add(New MailAddress(address))
- Next address
- Await MailUtil.SendGMailAsyncText(username, password, subject, body, addressCollection, attachments)
- End Function
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Asynchronously sends a mail with a plain text body through Google GMail SMTP server.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim addressCollection As New MailAddressCollection
- ''' addressCollection.Add(New MailAddress("Address@Server.com"))
- ''' addressCollection.Add(New MailAddress("Address2@Server.com"))
- ''' Await SendGMailAsyncText("Username@GMail.com", "Password", "Email Subject", "Message Body", addressCollection)
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="username">
- ''' The username of the Gmail account.
- ''' </param>
- '''
- ''' <param name="password">
- ''' The password of the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="addresses">
- ''' The target addresses that will receive our sent mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Async Function SendGMailAsyncText(ByVal username As String,
- ByVal password As String,
- ByVal subject As String,
- ByVal body As String,
- ByVal addresses As MailAddressCollection) As Task
- Await MailUtil.SendGMailAsyncText(username, password, subject, body, addresses, attachments:=Nothing)
- End Function
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Asynchronously sends a mail with a plain text body through Google GMail SMTP server.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim addressCollection As New MailAddressCollection
- ''' addressCollection.Add(New MailAddress("Address@Server.com"))
- ''' addressCollection.Add(New MailAddress("Address2@Server.com"))
- ''' Await SendGMailAsyncText("Username@GMail.com", "Password", "Email Subject", "Message Body", addressCollection, New Attachment("C:\File.txt"))
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="username">
- ''' The username of the Gmail account.
- ''' </param>
- '''
- ''' <param name="password">
- ''' The password of the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="addresses">
- ''' The target addresses that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Async Function SendGMailAsyncText(ByVal username As String,
- ByVal password As String,
- ByVal subject As String,
- ByVal body As String,
- ByVal addresses As MailAddressCollection,
- ParamArray attachments As Attachment()) As Task
- Dim attachCol As New Collection(Of Attachment)
- For Each attachment As Attachment In attachments
- attachCol.Add(attachment)
- Next attachment
- Await MailUtil.SendGMailAsyncText(username, password, subject, body, addresses, attachCol)
- End Function
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Asynchronously sends a mail with a plain text body through Google GMail SMTP server.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim addressCollection As New MailAddressCollection
- ''' addressCollection.Add(New MailAddress("Address@Server.com"))
- ''' addressCollection.Add(New MailAddress("Address2@Server.com"))
- '''
- ''' Dim attachments As New Collection(Of Attachment) From {New Attachment("C:\File1.txt"), New Attachment("C:\File2.txt")}
- '''
- ''' Await SendGMailAsyncText("Username@GMail.com", "Password", "Email Subject", "Message Body", addressCollection, attachments)
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="username">
- ''' The username of the Gmail account.
- ''' </param>
- '''
- ''' <param name="password">
- ''' The password of the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="addresses">
- ''' The target addresses that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Async Function SendGMailAsyncText(ByVal username As String,
- ByVal password As String,
- ByVal subject As String,
- ByVal body As String,
- ByVal addresses As MailAddressCollection,
- ByVal attachments As Collection(Of Attachment)) As Task
- Await MailUtil.SendGMailAsync(username, password, subject, body, addresses, attachments, isBodyHtml:=False)
- End Function
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Asynchronously sends a mail with a plain text body through Google GMail SMTP server.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim credential As New NetworkCredential("Username@Gmail.com", "Password")
- ''' Await SendGMailAsyncText(credential, "Email Subject", "Message Body", "Address@Server.com")
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="credential">
- ''' The credential containing the username and password for the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="address">
- ''' The target address that will receive our sent mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Async Function SendGMailAsyncText(ByVal credential As NetworkCredential,
- ByVal subject As String,
- ByVal body As String,
- ByVal address As String) As Task
- Await MailUtil.SendGMailAsyncText(credential.UserName, credential.Password, subject, body, {address})
- End Function
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Asynchronously sends a mail with a plain text body through Google GMail SMTP server.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim credential As New NetworkCredential("Username@Gmail.com", "Password")
- ''' Await SendGMailAsyncText(credential, "Email Subject", "Message Body", "Address@Server.com", New Attachment("C:\File.txt"))
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="credential">
- ''' The credential containing the username and password for the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="address">
- ''' The target address that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Async Function SendGMailAsyncText(ByVal credential As NetworkCredential,
- ByVal subject As String,
- ByVal body As String,
- ByVal address As String,
- ParamArray attachments As Attachment()) As Task
- Await MailUtil.SendGMailAsyncText(credential.UserName, credential.Password, subject, body, {address}, attachments)
- End Function
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Asynchronously sends a mail with a plain text body through Google GMail SMTP server.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim credential As New NetworkCredential("Username@Gmail.com", "Password")
- ''' Dim attachments As New Collection(Of Attachment) From {New Attachment("C:\File1.txt"), New Attachment("C:\File2.txt")}
- ''' Await SendGMailAsyncText(credential, "Email Subject", "Message Body", "Address@Server.com", attachments)
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="credential">
- ''' The credential containing the username and password for the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="address">
- ''' The target address that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Async Function SendGMailAsyncText(ByVal credential As NetworkCredential,
- ByVal subject As String,
- ByVal body As String,
- ByVal address As String,
- ByVal attachments As Collection(Of Attachment)) As Task
- Await MailUtil.SendGMailAsyncText(credential.UserName, credential.Password, subject, body, {address}, attachments)
- End Function
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Asynchronously sends a mail with a plain text body through Google GMail SMTP server.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim credential As New NetworkCredential("Username@Gmail.com", "Password")
- ''' Await SendGMailAsyncText(credential, "Email Subject", "Message Body", New MailAddress("Address@Server.com"))
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="credential">
- ''' The credential containing the username and password for the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="address">
- ''' The target address that will receive our sent mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Async Function SendGMailAsyncText(ByVal credential As NetworkCredential,
- ByVal subject As String,
- ByVal body As String,
- ByVal address As MailAddress) As Task
- Await MailUtil.SendGMailAsyncText(credential.UserName, credential.Password, subject, body, {address.Address})
- End Function
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Asynchronously sends a mail with a plain text body through Google GMail SMTP server.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim credential As New NetworkCredential("Username@Gmail.com", "Password")
- ''' Await SendGMailAsyncText(credential, "Email Subject", "Message Body", New MailAddress("Address@Server.com"), New Attachment("C:\File.txt"))
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="credential">
- ''' The credential containing the username and password for the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="address">
- ''' The target address that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Async Function SendGMailAsyncText(ByVal credential As NetworkCredential,
- ByVal subject As String,
- ByVal body As String,
- ByVal address As MailAddress,
- ParamArray attachments As Attachment()) As Task
- Await MailUtil.SendGMailAsyncText(credential.UserName, credential.Password, subject, body, {address.Address}, attachments)
- End Function
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Asynchronously sends a mail with a plain text body through Google GMail SMTP server.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim credential As New NetworkCredential("Username@Gmail.com", "Password")
- ''' Dim attachments As New Collection(Of Attachment) From {New Attachment("C:\File1.txt"), New Attachment("C:\File2.txt")}
- ''' Await SendGMailAsyncText(credential, "Email Subject", "Message Body", New MailAddress("Address@Server.com"), attachments)
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="credential">
- ''' The credential containing the username and password for the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="address">
- ''' The target address that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Async Function SendGMailAsyncText(ByVal credential As NetworkCredential,
- ByVal subject As String,
- ByVal body As String,
- ByVal address As MailAddress,
- ByVal attachments As Collection(Of Attachment)) As Task
- Await MailUtil.SendGMailAsyncText(credential.UserName, credential.Password, subject, body, {address.Address}, attachments)
- End Function
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Asynchronously sends a mail with a plain text body through Google GMail SMTP server.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim credential As New NetworkCredential("Username@Gmail.com", "Password")
- ''' Await SendGMailAsyncText(credential, "Email Subject", "Message Body", {"Address1@Server.com", "Address2@Server.com"})
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="credential">
- ''' The credential containing the username and password for the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="addresses">
- ''' The target addresses that will receive our sent mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Async Function SendGMailAsyncText(ByVal credential As NetworkCredential,
- ByVal subject As String,
- ByVal body As String,
- ByVal addresses As String()) As Task
- Dim addressCollection As New MailAddressCollection
- For Each address As String In addresses
- addressCollection.Add(New MailAddress(address))
- Next address
- Await MailUtil.SendGMailAsyncText(credential.UserName, credential.Password, subject, body, addressCollection)
- End Function
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Asynchronously sends a mail with a plain text body through Google GMail SMTP server.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim credential As New NetworkCredential("Username@Gmail.com", "Password")
- ''' Await SendGMailAsyncText(credential, "Email Subject", "Message Body", {"Address1@Server.com", "Address2@Server.com"}, New Attachment("C:\File.txt"))
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="credential">
- ''' The credential containing the username and password for the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="addresses">
- ''' The target addresses that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Async Function SendGMailAsyncText(ByVal credential As NetworkCredential,
- ByVal subject As String,
- ByVal body As String,
- ByVal addresses As String(),
- ParamArray attachments As Attachment()) As Task
- Dim addressCollection As New MailAddressCollection
- For Each address As String In addresses
- addressCollection.Add(New MailAddress(address))
- Next address
- Await MailUtil.SendGMailAsyncText(credential.UserName, credential.Password, subject, body, addressCollection, attachments)
- End Function
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Asynchronously sends a mail with a plain text body through Google GMail SMTP server.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim credential As New NetworkCredential("Username@Gmail.com", "Password")
- ''' Dim attachments As New Collection(Of Attachment) From {New Attachment("C:\File1.txt"), New Attachment("C:\File2.txt")}
- ''' Await SendGMailAsyncText(credential, "Email Subject", "Message Body", {"Address1@Server.com", "Address2@Server.com"}, attachments)
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="credential">
- ''' The credential containing the username and password for the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="addresses">
- ''' The target addresses that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Async Function SendGMailAsyncText(ByVal credential As NetworkCredential,
- ByVal subject As String,
- ByVal body As String,
- ByVal addresses As String(),
- ByVal attachments As Collection(Of Attachment)) As Task
- Dim addressCollection As New MailAddressCollection
- For Each address As String In addresses
- addressCollection.Add(New MailAddress(address))
- Next address
- Await MailUtil.SendGMailAsyncText(credential.UserName, credential.Password, subject, body, addressCollection, attachments)
- End Function
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Asynchronously sends a mail with a plain text body through Google GMail SMTP server.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim credential As New NetworkCredential("Username@Gmail.com", "Password")
- ''' Dim addressCollection As New MailAddressCollection
- ''' addressCollection.Add(New MailAddress("Address@Server.com"))
- ''' addressCollection.Add(New MailAddress("Address2@Server.com"))
- ''' Await SendGMailAsyncText(credential, "Email Subject", "Message Body", addressCollection)
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="credential">
- ''' The credential containing the username and password for the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="addresses">
- ''' The target addresses that will receive our sent mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Async Function SendGMailAsyncText(ByVal credential As NetworkCredential,
- ByVal subject As String,
- ByVal body As String,
- ByVal addresses As MailAddressCollection) As Task
- Await MailUtil.SendGMailAsyncText(credential.UserName, credential.Password, subject, body, addresses, attachments:=Nothing)
- End Function
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Asynchronously sends a mail with a plain text body through Google GMail SMTP server.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim credential As New NetworkCredential("Username@Gmail.com", "Password")
- ''' Dim addressCollection As New MailAddressCollection
- ''' addressCollection.Add(New MailAddress("Address@Server.com"))
- ''' addressCollection.Add(New MailAddress("Address2@Server.com"))
- ''' Await SendGMailAsyncText(credential, "Email Subject", "Message Body", addressCollection, New Attachment("C:\File.txt"))
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="credential">
- ''' The credential containing the username and password for the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="addresses">
- ''' The target addresses that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Async Function SendGMailAsyncText(ByVal credential As NetworkCredential,
- ByVal subject As String,
- ByVal body As String,
- ByVal addresses As MailAddressCollection,
- ParamArray attachments As Attachment()) As Task
- Dim attachCol As New Collection(Of Attachment)
- For Each attachment As Attachment In attachments
- attachCol.Add(attachment)
- Next attachment
- Await MailUtil.SendGMailAsyncText(credential.UserName, credential.Password, subject, body, addresses, attachCol)
- End Function
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Asynchronously sends a mail with a plain text body through Google GMail SMTP server.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim credential As New NetworkCredential("Username@Gmail.com", "Password")
- ''' Dim addressCollection As New MailAddressCollection
- ''' addressCollection.Add(New MailAddress("Address@Server.com"))
- ''' addressCollection.Add(New MailAddress("Address2@Server.com"))
- '''
- ''' Dim attachments As New Collection(Of Attachment) From {New Attachment("C:\File1.txt"), New Attachment("C:\File2.txt")}
- '''
- ''' Await SendGMailAsyncText(credential, "Email Subject", "Message Body", addressCollection, attachments)
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="credential">
- ''' The credential containing the username and password for the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="addresses">
- ''' The target addresses that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Async Function SendGMailAsyncText(ByVal credential As NetworkCredential,
- ByVal subject As String,
- ByVal body As String,
- ByVal addresses As MailAddressCollection,
- ByVal attachments As Collection(Of Attachment)) As Task
- Await MailUtil.SendGMailAsync(credential.UserName, credential.Password, subject, body, addresses, attachments, isBodyHtml:=False)
- End Function
- #End Region
- #Region " (ASYNC) HTML Body "
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Asynchronously sends a mail with a HTML body through Google GMail SMTP server.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Await SendGMailAsyncHtml("Username@GMail.com", "Password", "Email Subject", "Message Body", "Address@Server.com")
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="username">
- ''' The username of the Gmail account.
- ''' </param>
- '''
- ''' <param name="password">
- ''' The password of the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="address">
- ''' The target address that will receive our sent mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Async Function SendGMailAsyncHtml(ByVal username As String,
- ByVal password As String,
- ByVal subject As String,
- ByVal body As String,
- ByVal address As String) As Task
- Await MailUtil.SendGMailAsyncHtml(username, password, subject, body, {address})
- End Function
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Asynchronously sends a mail with a HTML body through Google GMail SMTP server.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Await SendGMailAsyncHtml("Username@GMail.com", "Password", "Email Subject", "Message Body", "Address@Server.com", New Attachment("C:\File.txt"))
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="username">
- ''' The username of the Gmail account.
- ''' </param>
- '''
- ''' <param name="password">
- ''' The password of the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="address">
- ''' The target address that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Async Function SendGMailAsyncHtml(ByVal username As String,
- ByVal password As String,
- ByVal subject As String,
- ByVal body As String,
- ByVal address As String,
- ParamArray attachments As Attachment()) As Task
- Await MailUtil.SendGMailAsyncHtml(username, password, subject, body, {address}, attachments)
- End Function
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Asynchronously sends a mail with a HTML body through Google GMail SMTP server.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim attachments As New Collection(Of Attachment) From {New Attachment("C:\File1.txt"), New Attachment("C:\File2.txt")}
- ''' Await SendGMailAsyncHtml("Username@GMail.com", "Password", "Email Subject", "Message Body", "Address@Server.com", attachments)
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="username">
- ''' The username of the Gmail account.
- ''' </param>
- '''
- ''' <param name="password">
- ''' The password of the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="address">
- ''' The target address that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Async Function SendGMailAsyncHtml(ByVal username As String,
- ByVal password As String,
- ByVal subject As String,
- ByVal body As String,
- ByVal address As String,
- ByVal attachments As Collection(Of Attachment)) As Task
- Await MailUtil.SendGMailAsyncHtml(username, password, subject, body, {address}, attachments)
- End Function
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Asynchronously sends a mail with a HTML body through Google GMail SMTP server.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Await SendGMailAsyncHtml("Username@GMail.com", "Password", "Email Subject", "Message Body", New MailAddress("Address@Server.com"))
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="username">
- ''' The username of the Gmail account.
- ''' </param>
- '''
- ''' <param name="password">
- ''' The password of the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="address">
- ''' The target address that will receive our sent mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Async Function SendGMailAsyncHtml(ByVal username As String,
- ByVal password As String,
- ByVal subject As String,
- ByVal body As String,
- ByVal address As MailAddress) As Task
- Await MailUtil.SendGMailAsyncHtml(username, password, subject, body, {address.Address})
- End Function
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Asynchronously sends a mail with a HTML body through Google GMail SMTP server.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Await SendGMailAsyncHtml("Username@GMail.com", "Password", "Email Subject", "Message Body", New MailAddress("Address@Server.com"), New Attachment("C:\File.txt"))
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="username">
- ''' The username of the Gmail account.
- ''' </param>
- '''
- ''' <param name="password">
- ''' The password of the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="address">
- ''' The target address that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Async Function SendGMailAsyncHtml(ByVal username As String,
- ByVal password As String,
- ByVal subject As String,
- ByVal body As String,
- ByVal address As MailAddress,
- ParamArray attachments As Attachment()) As Task
- Await MailUtil.SendGMailAsyncHtml(username, password, subject, body, {address.Address}, attachments)
- End Function
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Asynchronously sends a mail with a HTML body through Google GMail SMTP server.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim attachments As New Collection(Of Attachment) From {New Attachment("C:\File1.txt"), New Attachment("C:\File2.txt")}
- ''' Await SendGMailAsyncHtml("Username@GMail.com", "Password", "Email Subject", "Message Body", New MailAddress("Address@Server.com"), attachments)
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="username">
- ''' The username of the Gmail account.
- ''' </param>
- '''
- ''' <param name="password">
- ''' The password of the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="address">
- ''' The target address that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Async Function SendGMailAsyncHtml(ByVal username As String,
- ByVal password As String,
- ByVal subject As String,
- ByVal body As String,
- ByVal address As MailAddress,
- ByVal attachments As Collection(Of Attachment)) As Task
- Await MailUtil.SendGMailAsyncHtml(username, password, subject, body, {address.Address}, attachments)
- End Function
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Asynchronously sends a mail with a HTML body through Google GMail SMTP server.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Await SendGMailAsyncHtml("Username@GMail.com", "Password", "Email Subject", "Message Body", {"Address1@Server.com", "Address2@Server.com"})
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="username">
- ''' The username of the Gmail account.
- ''' </param>
- '''
- ''' <param name="password">
- ''' The password of the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="addresses">
- ''' The target addresses that will receive our sent mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Async Function SendGMailAsyncHtml(ByVal username As String,
- ByVal password As String,
- ByVal subject As String,
- ByVal body As String,
- ByVal addresses As String()) As Task
- Dim addressCollection As New MailAddressCollection
- For Each address As String In addresses
- addressCollection.Add(New MailAddress(address))
- Next address
- Await MailUtil.SendGMailAsyncHtml(username, password, subject, body, addressCollection)
- End Function
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Asynchronously sends a mail with a HTML body through Google GMail SMTP server.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Await SendGMailAsyncHtml("Username@GMail.com", "Password", "Email Subject", "Message Body", {"Address1@Server.com", "Address2@Server.com"}, New Attachment("C:\File.txt"))
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="username">
- ''' The username of the Gmail account.
- ''' </param>
- '''
- ''' <param name="password">
- ''' The password of the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="addresses">
- ''' The target addresses that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Async Function SendGMailAsyncHtml(ByVal username As String,
- ByVal password As String,
- ByVal subject As String,
- ByVal body As String,
- ByVal addresses As String(),
- ParamArray attachments As Attachment()) As Task
- Dim addressCollection As New MailAddressCollection
- For Each address As String In addresses
- addressCollection.Add(New MailAddress(address))
- Next address
- Await MailUtil.SendGMailAsyncHtml(username, password, subject, body, addressCollection, attachments)
- End Function
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Asynchronously sends a mail with a HTML body through Google GMail SMTP server.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim attachments As New Collection(Of Attachment) From {New Attachment("C:\File1.txt"), New Attachment("C:\File2.txt")}
- ''' Await SendGMailAsyncHtml("Username@GMail.com", "Password", "Email Subject", "Message Body", {"Address1@Server.com", "Address2@Server.com"}, attachments)
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="username">
- ''' The username of the Gmail account.
- ''' </param>
- '''
- ''' <param name="password">
- ''' The password of the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="addresses">
- ''' The target addresses that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Async Function SendGMailAsyncHtml(ByVal username As String,
- ByVal password As String,
- ByVal subject As String,
- ByVal body As String,
- ByVal addresses As String(),
- ByVal attachments As Collection(Of Attachment)) As Task
- Dim addressCollection As New MailAddressCollection
- For Each address As String In addresses
- addressCollection.Add(New MailAddress(address))
- Next address
- Await MailUtil.SendGMailAsyncHtml(username, password, subject, body, addressCollection, attachments)
- End Function
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Asynchronously sends a mail with a HTML body through Google GMail SMTP server.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim addressCollection As New MailAddressCollection
- ''' addressCollection.Add(New MailAddress("Address@Server.com"))
- ''' addressCollection.Add(New MailAddress("Address2@Server.com"))
- ''' Await SendGMailAsyncHtml("Username@GMail.com", "Password", "Email Subject", "Message Body", addressCollection)
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="username">
- ''' The username of the Gmail account.
- ''' </param>
- '''
- ''' <param name="password">
- ''' The password of the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="addresses">
- ''' The target addresses that will receive our sent mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Async Function SendGMailAsyncHtml(ByVal username As String,
- ByVal password As String,
- ByVal subject As String,
- ByVal body As String,
- ByVal addresses As MailAddressCollection) As Task
- Await MailUtil.SendGMailAsyncHtml(username, password, subject, body, addresses, attachments:=Nothing)
- End Function
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Asynchronously sends a mail with a HTML body through Google GMail SMTP server.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim addressCollection As New MailAddressCollection
- ''' addressCollection.Add(New MailAddress("Address@Server.com"))
- ''' addressCollection.Add(New MailAddress("Address2@Server.com"))
- ''' Await SendGMailAsyncHtml("Username@GMail.com", "Password", "Email Subject", "Message Body", addressCollection, New Attachment("C:\File.txt"))
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="username">
- ''' The username of the Gmail account.
- ''' </param>
- '''
- ''' <param name="password">
- ''' The password of the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="addresses">
- ''' The target addresses that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Async Function SendGMailAsyncHtml(ByVal username As String,
- ByVal password As String,
- ByVal subject As String,
- ByVal body As String,
- ByVal addresses As MailAddressCollection,
- ParamArray attachments As Attachment()) As Task
- Dim attachCol As New Collection(Of Attachment)
- For Each attachment As Attachment In attachments
- attachCol.Add(attachment)
- Next attachment
- Await MailUtil.SendGMailAsyncHtml(username, password, subject, body, addresses, attachCol)
- End Function
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Asynchronously sends a mail with a HTML body through Google GMail SMTP server.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim addressCollection As New MailAddressCollection
- ''' addressCollection.Add(New MailAddress("Address@Server.com"))
- ''' addressCollection.Add(New MailAddress("Address2@Server.com"))
- '''
- ''' Dim attachments As New Collection(Of Attachment) From {New Attachment("C:\File1.txt"), New Attachment("C:\File2.txt")}
- '''
- ''' Await SendGMailAsyncHtml("Username@GMail.com", "Password", "Email Subject", "Message Body", addressCollection, attachments)
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="username">
- ''' The username of the Gmail account.
- ''' </param>
- '''
- ''' <param name="password">
- ''' The password of the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="addresses">
- ''' The target addresses that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Async Function SendGMailAsyncHtml(ByVal username As String,
- ByVal password As String,
- ByVal subject As String,
- ByVal body As String,
- ByVal addresses As MailAddressCollection,
- ByVal attachments As Collection(Of Attachment)) As Task
- Await MailUtil.SendGMailAsync(username, password, subject, body, addresses, attachments, isBodyHtml:=False)
- End Function
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Asynchronously sends a mail with a HTML body through Google GMail SMTP server.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim credential As New NetworkCredential("Username@Gmail.com", "Password")
- ''' Await SendGMailAsyncHtml(credential, "Email Subject", "Message Body", "Address@Server.com")
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="credential">
- ''' The credential containing the username and password for the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="address">
- ''' The target address that will receive our sent mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Async Function SendGMailAsyncHtml(ByVal credential As NetworkCredential,
- ByVal subject As String,
- ByVal body As String,
- ByVal address As String) As Task
- Await MailUtil.SendGMailAsyncHtml(credential.UserName, credential.Password, subject, body, {address})
- End Function
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Asynchronously sends a mail with a HTML body through Google GMail SMTP server.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim credential As New NetworkCredential("Username@Gmail.com", "Password")
- ''' Await SendGMailAsyncHtml(credential, "Email Subject", "Message Body", "Address@Server.com", New Attachment("C:\File.txt"))
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="credential">
- ''' The credential containing the username and password for the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="address">
- ''' The target address that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Async Function SendGMailAsyncHtml(ByVal credential As NetworkCredential,
- ByVal subject As String,
- ByVal body As String,
- ByVal address As String,
- ParamArray attachments As Attachment()) As Task
- Await MailUtil.SendGMailAsyncHtml(credential.UserName, credential.Password, subject, body, {address}, attachments)
- End Function
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Asynchronously sends a mail with a HTML body through Google GMail SMTP server.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim credential As New NetworkCredential("Username@Gmail.com", "Password")
- ''' Dim attachments As New Collection(Of Attachment) From {New Attachment("C:\File1.txt"), New Attachment("C:\File2.txt")}
- ''' Await SendGMailAsyncHtml(credential, "Email Subject", "Message Body", "Address@Server.com", attachments)
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="credential">
- ''' The credential containing the username and password for the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="address">
- ''' The target address that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Async Function SendGMailAsyncHtml(ByVal credential As NetworkCredential,
- ByVal subject As String,
- ByVal body As String,
- ByVal address As String,
- ByVal attachments As Collection(Of Attachment)) As Task
- Await MailUtil.SendGMailAsyncHtml(credential.UserName, credential.Password, subject, body, {address}, attachments)
- End Function
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Asynchronously sends a mail with a HTML body through Google GMail SMTP server.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim credential As New NetworkCredential("Username@Gmail.com", "Password")
- ''' Await SendGMailAsyncHtml(credential, "Email Subject", "Message Body", New MailAddress("Address@Server.com"))
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="credential">
- ''' The credential containing the username and password for the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="address">
- ''' The target address that will receive our sent mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Async Function SendGMailAsyncHtml(ByVal credential As NetworkCredential,
- ByVal subject As String,
- ByVal body As String,
- ByVal address As MailAddress) As Task
- Await MailUtil.SendGMailAsyncHtml(credential.UserName, credential.Password, subject, body, {address.Address})
- End Function
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Asynchronously sends a mail with a HTML body through Google GMail SMTP server.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim credential As New NetworkCredential("Username@Gmail.com", "Password")
- ''' Await SendGMailAsyncHtml(credential, "Email Subject", "Message Body", New MailAddress("Address@Server.com"), New Attachment("C:\File.txt"))
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="credential">
- ''' The credential containing the username and password for the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="address">
- ''' The target address that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Async Function SendGMailAsyncHtml(ByVal credential As NetworkCredential,
- ByVal subject As String,
- ByVal body As String,
- ByVal address As MailAddress,
- ParamArray attachments As Attachment()) As Task
- Await MailUtil.SendGMailAsyncHtml(credential.UserName, credential.Password, subject, body, {address.Address}, attachments)
- End Function
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Asynchronously sends a mail with a HTML body through Google GMail SMTP server.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim credential As New NetworkCredential("Username@Gmail.com", "Password")
- ''' Dim attachments As New Collection(Of Attachment) From {New Attachment("C:\File1.txt"), New Attachment("C:\File2.txt")}
- ''' Await SendGMailAsyncHtml(credential, "Email Subject", "Message Body", New MailAddress("Address@Server.com"), attachments)
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="credential">
- ''' The credential containing the username and password for the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="address">
- ''' The target address that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Async Function SendGMailAsyncHtml(ByVal credential As NetworkCredential,
- ByVal subject As String,
- ByVal body As String,
- ByVal address As MailAddress,
- ByVal attachments As Collection(Of Attachment)) As Task
- Await MailUtil.SendGMailAsyncHtml(credential.UserName, credential.Password, subject, body, {address.Address}, attachments)
- End Function
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Asynchronously sends a mail with a HTML body through Google GMail SMTP server.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim credential As New NetworkCredential("Username@Gmail.com", "Password")
- ''' Await SendGMailAsyncHtml(credential, "Email Subject", "Message Body", {"Address1@Server.com", "Address2@Server.com"})
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="credential">
- ''' The credential containing the username and password for the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="addresses">
- ''' The target addresses that will receive our sent mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Async Function SendGMailAsyncHtml(ByVal credential As NetworkCredential,
- ByVal subject As String,
- ByVal body As String,
- ByVal addresses As String()) As Task
- Dim addressCollection As New MailAddressCollection
- For Each address As String In addresses
- addressCollection.Add(New MailAddress(address))
- Next address
- Await MailUtil.SendGMailAsyncHtml(credential.UserName, credential.Password, subject, body, addressCollection)
- End Function
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Asynchronously sends a mail with a HTML body through Google GMail SMTP server.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim credential As New NetworkCredential("Username@Gmail.com", "Password")
- ''' Await SendGMailAsyncHtml(credential, "Email Subject", "Message Body", {"Address1@Server.com", "Address2@Server.com"}, New Attachment("C:\File.txt"))
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="credential">
- ''' The credential containing the username and password for the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="addresses">
- ''' The target addresses that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Async Function SendGMailAsyncHtml(ByVal credential As NetworkCredential,
- ByVal subject As String,
- ByVal body As String,
- ByVal addresses As String(),
- ParamArray attachments As Attachment()) As Task
- Dim addressCollection As New MailAddressCollection
- For Each address As String In addresses
- addressCollection.Add(New MailAddress(address))
- Next address
- Await MailUtil.SendGMailAsyncHtml(credential.UserName, credential.Password, subject, body, addressCollection, attachments)
- End Function
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Asynchronously sends a mail with a HTML body through Google GMail SMTP server.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim credential As New NetworkCredential("Username@Gmail.com", "Password")
- ''' Dim attachments As New Collection(Of Attachment) From {New Attachment("C:\File1.txt"), New Attachment("C:\File2.txt")}
- ''' Await SendGMailAsyncHtml(credential, "Email Subject", "Message Body", {"Address1@Server.com", "Address2@Server.com"}, attachments)
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="credential">
- ''' The credential containing the username and password for the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="addresses">
- ''' The target addresses that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Async Function SendGMailAsyncHtml(ByVal credential As NetworkCredential,
- ByVal subject As String,
- ByVal body As String,
- ByVal addresses As String(),
- ByVal attachments As Collection(Of Attachment)) As Task
- Dim addressCollection As New MailAddressCollection
- For Each address As String In addresses
- addressCollection.Add(New MailAddress(address))
- Next address
- Await MailUtil.SendGMailAsyncHtml(credential.UserName, credential.Password, subject, body, addressCollection, attachments)
- End Function
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Asynchronously sends a mail with a HTML body through Google GMail SMTP server.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim credential As New NetworkCredential("Username@Gmail.com", "Password")
- ''' Dim addressCollection As New MailAddressCollection
- ''' addressCollection.Add(New MailAddress("Address@Server.com"))
- ''' addressCollection.Add(New MailAddress("Address2@Server.com"))
- ''' Await SendGMailAsyncHtml(credential, "Email Subject", "Message Body", addressCollection)
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="credential">
- ''' The credential containing the username and password for the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="addresses">
- ''' The target addresses that will receive our sent mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Async Function SendGMailAsyncHtml(ByVal credential As NetworkCredential,
- ByVal subject As String,
- ByVal body As String,
- ByVal addresses As MailAddressCollection) As Task
- Await MailUtil.SendGMailAsyncHtml(credential.UserName, credential.Password, subject, body, addresses, attachments:=Nothing)
- End Function
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Asynchronously sends a mail with a HTML body through Google GMail SMTP server.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim credential As New NetworkCredential("Username@Gmail.com", "Password")
- ''' Dim addressCollection As New MailAddressCollection
- ''' addressCollection.Add(New MailAddress("Address@Server.com"))
- ''' addressCollection.Add(New MailAddress("Address2@Server.com"))
- ''' Await SendGMailAsyncHtml(credential, "Email Subject", "Message Body", addressCollection, New Attachment("C:\File.txt"))
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="credential">
- ''' The credential containing the username and password for the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="addresses">
- ''' The target addresses that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Async Function SendGMailAsyncHtml(ByVal credential As NetworkCredential,
- ByVal subject As String,
- ByVal body As String,
- ByVal addresses As MailAddressCollection,
- ParamArray attachments As Attachment()) As Task
- Dim attachCol As New Collection(Of Attachment)
- For Each attachment As Attachment In attachments
- attachCol.Add(attachment)
- Next attachment
- Await MailUtil.SendGMailAsyncHtml(credential.UserName, credential.Password, subject, body, addresses, attachCol)
- End Function
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Asynchronously sends a mail with a HTML body through Google GMail SMTP server.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim credential As New NetworkCredential("Username@Gmail.com", "Password")
- ''' Dim addressCollection As New MailAddressCollection
- ''' addressCollection.Add(New MailAddress("Address@Server.com"))
- ''' addressCollection.Add(New MailAddress("Address2@Server.com"))
- '''
- ''' Dim attachments As New Collection(Of Attachment) From {New Attachment("C:\File1.txt"), New Attachment("C:\File2.txt")}
- '''
- ''' Await SendGMailAsyncHtml(credential, "Email Subject", "Message Body", addressCollection, attachments)
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="credential">
- ''' The credential containing the username and password for the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="addresses">
- ''' The target addresses that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Async Function SendGMailAsyncHtml(ByVal credential As NetworkCredential,
- ByVal subject As String,
- ByVal body As String,
- ByVal addresses As MailAddressCollection,
- ByVal attachments As Collection(Of Attachment)) As Task
- Await MailUtil.SendGMailAsync(credential.UserName, credential.Password, subject, body, addresses, attachments, isBodyHtml:=True)
- End Function
- #End Region
- #End If
- #End Region
- #Region " Private Methods "
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Sends a mail through Google GMail SMTP server.
- ''' <para></para>
- ''' Note that in order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim addressCollection As New MailAddressCollection
- ''' addressCollection.Add(New MailAddress("Address@Server.com"))
- ''' addressCollection.Add(New MailAddress("Address2@Server.com"))
- '''
- ''' Dim attachments As New Collection(Of Attachment) From {New Attachment("C:\File1.txt"), New Attachment("C:\File2.txt")}
- '''
- ''' SendGMail("Username@Gmail.com", "Password", "Email Subject", "Message Body", addressCollection, attachments, isBodyHtml:=False)
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <remarks>
- ''' In order to send SMTP messages, you must enable application access for your GMail account by following this url:
- ''' <para></para>
- ''' <see href="http://www.google.com/settings/security/lesssecureapps"/>
- ''' </remarks>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="username">
- ''' The username of the Gmail account.
- ''' </param>
- '''
- ''' <param name="password">
- ''' The password of the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="addresses">
- ''' The target addresses that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- '''
- ''' <param name="isBodyHtml">
- ''' Indicates whether the mail body is html or plain text.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Private Shared Sub SendGMail(ByVal username As String,
- ByVal password As String,
- ByVal subject As String,
- ByVal body As String,
- ByVal addresses As MailAddressCollection,
- ByVal attachments As Collection(Of Attachment),
- ByVal isBodyHtml As Boolean)
- Using msg As New MailMessage
- For Each address As MailAddress In addresses
- msg.To.Add(address)
- Next address
- msg.From = New MailAddress(username)
- msg.Subject = subject
- msg.IsBodyHtml = isBodyHtml
- msg.Body = body
- If (attachments IsNot Nothing) Then
- For Each attachment As Attachment In attachments
- msg.Attachments.Add(attachment)
- Next attachment
- End If
- Using client As New SmtpClient()
- With client
- .Host = "smtp.gmail.com"
- .Port = 587
- .EnableSsl = True
- .DeliveryMethod = SmtpDeliveryMethod.Network
- .Timeout = CInt(TimeSpan.FromSeconds(60).TotalMilliseconds)
- .Credentials = New NetworkCredential(username, password)
- End With
- client.Send(msg)
- End Using
- End Using
- End Sub
- #If NET45 OrElse NET46 Then
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Asynchronously sends a mail through Google GMail SMTP server.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <example> This is a code example.
- ''' <code>
- ''' Dim addressCollection As New MailAddressCollection
- ''' addressCollection.Add(New MailAddress("Address@Server.com"))
- ''' addressCollection.Add(New MailAddress("Address2@Server.com"))
- '''
- ''' Dim attachments As New Collection(Of Attachment) From {New Attachment("C:\File1.txt"), New Attachment("C:\File2.txt")}
- '''
- ''' Await SendGMailAsync("Username@GMail.com", "Password", "Email Subject", "Message Body", addressCollection, attachments, isBodyHtml:=False)
- ''' </code>
- ''' </example>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="username">
- ''' The username of the Gmail account.
- ''' </param>
- '''
- ''' <param name="password">
- ''' The password of the Gmail account.
- ''' </param>
- '''
- ''' <param name="subject">
- ''' The mail subject.
- ''' </param>
- '''
- ''' <param name="body">
- ''' The mail body.
- ''' </param>
- '''
- ''' <param name="addresses">
- ''' The target addresses that will receive our sent mail.
- ''' </param>
- '''
- ''' <param name="attachments">
- ''' The file(s) to attach in this e-mail.
- ''' </param>
- '''
- ''' <param name="isBodyHtml">
- ''' Indicates whether the mail body is html or plain text.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Shared Async Function SendGMailAsync(ByVal username As String,
- ByVal password As String,
- ByVal subject As String,
- ByVal body As String,
- ByVal addresses As MailAddressCollection,
- ByVal attachments As Collection(Of Attachment),
- ByVal isBodyHtml As Boolean) As Task
- Using msg As New MailMessage
- For Each address As MailAddress In addresses
- msg.To.Add(address)
- Next
- msg.From = New MailAddress(username)
- msg.Subject = subject
- msg.IsBodyHtml = isBodyHtml
- msg.Body = body
- If (attachments IsNot Nothing) Then
- For Each attachment As Attachment In attachments
- msg.Attachments.Add(attachment)
- Next attachment
- End If
- Using client As New SmtpClient()
- With client
- .Host = "smtp.gmail.com"
- .Port = 587
- .EnableSsl = True
- .DeliveryMethod = SmtpDeliveryMethod.Network
- .Timeout = CInt(TimeSpan.FromSeconds(60).TotalMilliseconds)
- .Credentials = New NetworkCredential(username, password)
- End With
- Dim t As Task = client.SendMailAsync(msg)
- Await t
- End Using
- End Using
- End Function
- #End If
- #End Region
- End Class
- End Namespace
- #End Region
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement