SmtpClient (gb.net.smtp)

This class implements a SMTP client.

Tato třída je vytvořitelný.

Konstanty
Automatic   Use this constant to try any authentication protocol until one works.
CramMD5   Constant for the SMTP "CRAM-MD5" authentication protocol.
Login   Constant for the SMTP "LOGIN" authentication protocol.
Plain   Constant for the SMTP "PLAIN" authentication protocol.

Static methods
FormatDate   Format a date according to the RFC 822 syntax.

Vlastnosti
Alternative   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.
Authentication   Return or set the SMTP authentication protocol.
Bcc   Returns or sets the list of "Bcc" (i.e. blind carbon copy) recipients e-mail addresses.
Body   Return or set the mail body.
Cc   Returns or sets the list of "Cc" (i.e. carbon copy) recipients e-mail addresses.
Count   Return the number of parts in the current mail.
Debug   Return or set if the debugging mode is enabled for that SmtpClient.
Encrypt   Return or set the SMTP encryption method.
From   Returns or sets the return address of the mail.
Host   Returns or sets the SMTP server that will receive the mail.
InReplyTo   Return or set the In-Reply-To header.
MessageId   Return or set the Message-ID header.
Password   Return or set the user password.
Port   Returns or sets the SMTP port used by the SMTP server.
Subject   Returns or sets the mail subject.
To   Returns or sets the list of "To" recipients e-mail addresses.
User   Return or set the user login.

Metoda
Add   Adds an attachment to the mail.
AddHeader   Add a custom header to the mail.
Clear   Clear the attachments.
Send   Send the mail.

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