SmtpClient (gb.net.smtp)

This class implements a SMTP client.

This class is creatable.

Static methods

Constants
Format a date according to the RFC 822 syntax.
FormatDate  
Use this constant to try any authentication protocol until one works.
Automatic  
Constant for the SMTP "CRAM-MD5" authentication protocol.
CramMD5  
Constant for the SMTP "LOGIN" authentication protocol.
Login  
Constant for the SMTP "PLAIN" authentication protocol.
Plain  

Properties

Methods
Returns or sets if mail attachments are actually different alternatives of the same data. For example, a mail encoded in HTML, in UTF-8, or only in ASCII.
Alternative  
Return or set the SMTP authentication protocol.
Authentication  
Returns or sets the list of "Bcc" (i.e. blind carbon copy) recipients e-mail addresses.
Bcc  
Return or set the mail body.
Body  
Returns or sets the list of "Cc" (i.e. carbon copy) recipients e-mail addresses.
Cc  
Return the number of parts in the current mail.
Count  
Return or set if the debugging mode is enabled for that SmtpClient.
Debug  
Return or set the SMTP encryption method.
Encrypt  
Returns or sets the return address of the mail.
From  
Returns or sets the SMTP server that will receive the mail.
Host  
Return or set the In-Reply-To header.
InReplyTo  
Return or set the Message-ID header.
MessageId  
Return or set the user password.
Password  
Returns or sets the SMTP port used by the SMTP server.
Port  
Returns or sets the mail subject.
Subject  
Returns or sets the list of "To" recipients e-mail addresses.
To  
Return or set the user login.
User  
Adds an attachment to the mail.
Add  
Add a custom header to the mail.
AddHeader  
Clear  
Send the mail.
Send  

Plain Text Example


  Dim Email As New SmtpClient

  Email.Host = "MySMTPServer"
  Email.User = "MyUserName"
  Email.Password = "MyPassword"

  Email.From = "[email protected]"
  Email.To.Add("[email protected]")

  Email.Subject = "Hello World"
  Email.Body = "Hello World"

  Email.Send

HTML Example


  Dim Email As New SmtpClient
  Dim HtmlBody As String

  Email.Host = "MySMTPServer"
  Email.User = "MyUserName"
  Email.Password = "MyPassword"

  Email.From = "[email protected]"
  Email.To.Add("[email protected]")

  Email.Subject = "Hello World"
  Email.Body = "Hello World"

  HtmlBody = "<html><body>Hello <b>World</b></body></html>"
  Email.Alternative = True
  Email.Add(HtmlBody, "text/html")

  Email.Send