C# Класс Westwind.Utilities.InternetTools.SmtpClientNative

SMTP Wrapper around System.Net.Email.SmtpClient. Provided here mainly to provide compatibility with existing wwSmtp code and to provide a slightly more user friendly front end interface on a single object.
Наследование: IDisposable
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
AlternateText string
AlternateTextContentType string
AttachmentList List
Attachments string
BCC string
CC string
CharacterEncoding string
ContentType string
Encoding System.Text.Encoding
Error bool
ErrorMessage string
HandleExceptions bool
Headers string>.Dictionary
LogFile string
MailServer string
Message string
Password string
Priority string
Recipient string
ReplyTo string
ReturnReceipt bool
SenderEmail string
SenderName string
ServerPort int
Subject string
Timeout int
UseSsl bool
UserAgent string
Username string

Защищенные свойства (Protected)

Свойство Тип Описание
AlternateViews List

Открытые методы

Метод Описание
AddAlternateView ( System.Net.Mail.AlternateView view ) : void

Adds a new Alternate view to the request. Passed from FoxPro which sets up this object.

AddHeader ( string headerName, string value ) : void

Adds an Smtp header to this email request. Headers are always cleared after a message has been sent or failed.

AddHeadersFromString ( string headers ) : void

Adds headers from a CR/LF separate string that has key:value header pairs defined.

Close ( ) : bool

Cleans up and closes the connection

Connect ( ) : bool

Starts a new SMTP session. Note this doesn't actually open a connection but just configures and sets up the SMTP session. The actual connection is opened only when a message is actually sent

Dispose ( ) : void
LoadSmtpClient ( ) : SmtpClient

Lets you load the actual SMTP client instance prior to use so you can manipulate the actual Smtp instance.

SendMail ( ) : bool

Fully self contained mail sending method. Sends an email message by connecting and disconnecting from the email server.

SendMailAsync ( ) : void

Run mail sending operation on a separate thread and asynchronously Operation does not return any information about completion.

SendMessage ( string recipient, string ccList, string bccList ) : bool

Sends an individual message. Allows sending several messages on the same SMTP session without having to reconnect each time. This version assigns default properties assigned from the main mail object and allows overriding only of recipients Call after Connect() has been called and call Close() to close the connection afterwards

Защищенные методы

Метод Описание
GetMessage ( ) : MailMessage

Configures the message interface

LogString ( string message ) : void

Logs a message to the specified LogFile

SendMailRun ( ) : void

Приватные методы

Метод Описание
AssignMailAddresses ( MailAddressCollection address, string recipients ) : void

Assigns mail addresses from a string or comma delimited string list. Facilitates

GetEmailFromFullAddress ( string fullEmail ) : string

Strips out just the email address from a full email address that might contain a display name in the format of: "Web Monitor" <[email protected]>

SetError ( string errorMessage ) : void

Internally used to set errors

Описание методов

AddAlternateView() публичный Метод

Adds a new Alternate view to the request. Passed from FoxPro which sets up this object.
public AddAlternateView ( System.Net.Mail.AlternateView view ) : void
view System.Net.Mail.AlternateView
Результат void

AddHeader() публичный Метод

Adds an Smtp header to this email request. Headers are always cleared after a message has been sent or failed.
public AddHeader ( string headerName, string value ) : void
headerName string
value string
Результат void

AddHeadersFromString() публичный Метод

Adds headers from a CR/LF separate string that has key:value header pairs defined.
public AddHeadersFromString ( string headers ) : void
headers string
Результат void

Close() публичный Метод

Cleans up and closes the connection
public Close ( ) : bool
Результат bool

Connect() публичный Метод

Starts a new SMTP session. Note this doesn't actually open a connection but just configures and sets up the SMTP session. The actual connection is opened only when a message is actually sent
public Connect ( ) : bool
Результат bool

Dispose() публичный Метод

public Dispose ( ) : void
Результат void

GetMessage() защищенный Метод

Configures the message interface
protected GetMessage ( ) : MailMessage
Результат System.Net.Mail.MailMessage

LoadSmtpClient() публичный Метод

Lets you load the actual SMTP client instance prior to use so you can manipulate the actual Smtp instance.
public LoadSmtpClient ( ) : SmtpClient
Результат System.Net.Mail.SmtpClient

LogString() защищенный Метод

Logs a message to the specified LogFile
protected LogString ( string message ) : void
message string
Результат void

SendMail() публичный Метод

Fully self contained mail sending method. Sends an email message by connecting and disconnecting from the email server.
public SendMail ( ) : bool
Результат bool

SendMailAsync() публичный Метод

Run mail sending operation on a separate thread and asynchronously Operation does not return any information about completion.
public SendMailAsync ( ) : void
Результат void

SendMailRun() защищенный Метод

protected SendMailRun ( ) : void
Результат void

SendMessage() публичный Метод

Sends an individual message. Allows sending several messages on the same SMTP session without having to reconnect each time. This version assigns default properties assigned from the main mail object and allows overriding only of recipients Call after Connect() has been called and call Close() to close the connection afterwards
public SendMessage ( string recipient, string ccList, string bccList ) : bool
recipient string
ccList string
bccList string
Результат bool

Описание свойств

AlternateText публичное свойство

public string AlternateText
Результат string

AlternateTextContentType публичное свойство

The content type for the alternate
public string AlternateTextContentType
Результат string

AlternateViews защищенное свойство

protected List AlternateViews
Результат List

AttachmentList публичное свойство

List of attachment objects
public List AttachmentList
Результат List

Attachments публичное свойство

Any attachments you'd like to send
public string Attachments
Результат string

BCC публичное свойство

Blind Copy Recipients
public string BCC
Результат string

CC публичное свойство

Carbon Copy Recipients
public string CC
Результат string

CharacterEncoding публичное свойство

Character Encoding for the message.
public string CharacterEncoding
Результат string

ContentType публичное свойство

The content type of the message. text/plain default or you can set to any other type like text/html
public string ContentType
Результат string

Encoding публичное свойство

The character Encoding used to write the stream out to disk Defaults to the default Locale used on the server.
public Encoding,System.Text Encoding
Результат System.Text.Encoding

Error публичное свойство

Error Flag set when an error occurs.
public bool Error
Результат bool

ErrorMessage публичное свойство

An Error Message if the result is negative or Error is set to true;
public string ErrorMessage
Результат string

HandleExceptions публичное свойство

Determines whether wwSMTP passes back errors as exceptions or whether it sets error properties. Right now only error properties work reliably.
public bool HandleExceptions
Результат bool

Headers публичное свойство

SMTP headers for this email request
public Dictionary Headers
Результат string>.Dictionary

LogFile публичное свойство

An optional file name that appends logging information for the TCP/IP messaging to the specified file.
public string LogFile
Результат string

MailServer публичное свойство

Mail Server to send message through. Should be a domain name (mail.yourserver.net) or IP Address (211.123.123.123). You can also provide a port number as part of the string which will override the ServerPort (yourserver.net:211) Class wwSmtp
public string MailServer
Результат string

Message публичное свойство

The body of the message.
public string Message
Результат string

Password публичное свойство

Password to connect to the mail server.
public string Password
Результат string

Priority публичное свойство

Determines the priority of the message
public string Priority
Результат string

Recipient публичное свойство

Email address or addresses of the Recipient. Comma delimit multiple addresses. To have formatted names use "Rick Strahl" <[email protected]>
public string Recipient
Результат string

ReplyTo публичное свойство

The ReplyTo address
public string ReplyTo
Результат string

ReturnReceipt публичное свойство

Determines whether a return receipt is sent
public bool ReturnReceipt
Результат bool

SenderEmail публичное свойство

Email address of the sender
public string SenderEmail
Результат string

SenderName публичное свойство

Display name of the sender (optional)
public string SenderName
Результат string

ServerPort публичное свойство

Port on the mail server to send through. Defaults to port 25.
public int ServerPort
Результат int

Subject публичное свойство

Message Subject.
public string Subject
Результат string

Timeout публичное свойство

Connection timeouts for the mail server in seconds. If this timeout is exceeded waiting for a connection or for receiving or sending data the request is aborted and fails.
public int Timeout
Результат int

UseSsl публичное свойство

Use Tls Security
public bool UseSsl
Результат bool

UserAgent публичное свойство

The user agent for the x-mailer
public string UserAgent
Результат string

Username публичное свойство

Username to connect to the mail server.
public string Username
Результат string