C# Class 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.
Inheritance: IDisposable
Afficher le fichier Open project: RickStrahl/WestwindToolkit Class Usage Examples

Méthodes publiques

Свойство Type Description
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 Properties

Свойство Type Description
AlternateViews List

Méthodes publiques

Méthode Description
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

Méthodes protégées

Méthode Description
GetMessage ( ) : MailMessage

Configures the message interface

LogString ( string message ) : void

Logs a message to the specified LogFile

SendMailRun ( ) : void

Private Methods

Méthode Description
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

Method Details

AddAlternateView() public méthode

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
Résultat void

AddHeader() public méthode

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
Résultat void

AddHeadersFromString() public méthode

Adds headers from a CR/LF separate string that has key:value header pairs defined.
public AddHeadersFromString ( string headers ) : void
headers string
Résultat void

Close() public méthode

Cleans up and closes the connection
public Close ( ) : bool
Résultat bool

Connect() public méthode

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
Résultat bool

Dispose() public méthode

public Dispose ( ) : void
Résultat void

GetMessage() protected méthode

Configures the message interface
protected GetMessage ( ) : MailMessage
Résultat System.Net.Mail.MailMessage

LoadSmtpClient() public méthode

Lets you load the actual SMTP client instance prior to use so you can manipulate the actual Smtp instance.
public LoadSmtpClient ( ) : SmtpClient
Résultat System.Net.Mail.SmtpClient

LogString() protected méthode

Logs a message to the specified LogFile
protected LogString ( string message ) : void
message string
Résultat void

SendMail() public méthode

Fully self contained mail sending method. Sends an email message by connecting and disconnecting from the email server.
public SendMail ( ) : bool
Résultat bool

SendMailAsync() public méthode

Run mail sending operation on a separate thread and asynchronously Operation does not return any information about completion.
public SendMailAsync ( ) : void
Résultat void

SendMailRun() protected méthode

protected SendMailRun ( ) : void
Résultat void

SendMessage() public méthode

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
Résultat bool

Property Details

AlternateText public_oe property

public string AlternateText
Résultat string

AlternateTextContentType public_oe property

The content type for the alternate
public string AlternateTextContentType
Résultat string

AlternateViews protected_oe property

protected List AlternateViews
Résultat List

AttachmentList public_oe property

List of attachment objects
public List AttachmentList
Résultat List

Attachments public_oe property

Any attachments you'd like to send
public string Attachments
Résultat string

BCC public_oe property

Blind Copy Recipients
public string BCC
Résultat string

CC public_oe property

Carbon Copy Recipients
public string CC
Résultat string

CharacterEncoding public_oe property

Character Encoding for the message.
public string CharacterEncoding
Résultat string

ContentType public_oe property

The content type of the message. text/plain default or you can set to any other type like text/html
public string ContentType
Résultat string

Encoding public_oe property

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
Résultat System.Text.Encoding

Error public_oe property

Error Flag set when an error occurs.
public bool Error
Résultat bool

ErrorMessage public_oe property

An Error Message if the result is negative or Error is set to true;
public string ErrorMessage
Résultat string

HandleExceptions public_oe property

Determines whether wwSMTP passes back errors as exceptions or whether it sets error properties. Right now only error properties work reliably.
public bool HandleExceptions
Résultat bool

Headers public_oe property

SMTP headers for this email request
public Dictionary Headers
Résultat string>.Dictionary

LogFile public_oe property

An optional file name that appends logging information for the TCP/IP messaging to the specified file.
public string LogFile
Résultat string

MailServer public_oe property

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
Résultat string

Message public_oe property

The body of the message.
public string Message
Résultat string

Password public_oe property

Password to connect to the mail server.
public string Password
Résultat string

Priority public_oe property

Determines the priority of the message
public string Priority
Résultat string

Recipient public_oe property

Email address or addresses of the Recipient. Comma delimit multiple addresses. To have formatted names use "Rick Strahl" <[email protected]>
public string Recipient
Résultat string

ReplyTo public_oe property

The ReplyTo address
public string ReplyTo
Résultat string

ReturnReceipt public_oe property

Determines whether a return receipt is sent
public bool ReturnReceipt
Résultat bool

SenderEmail public_oe property

Email address of the sender
public string SenderEmail
Résultat string

SenderName public_oe property

Display name of the sender (optional)
public string SenderName
Résultat string

ServerPort public_oe property

Port on the mail server to send through. Defaults to port 25.
public int ServerPort
Résultat int

Subject public_oe property

Message Subject.
public string Subject
Résultat string

Timeout public_oe property

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
Résultat int

UseSsl public_oe property

Use Tls Security
public bool UseSsl
Résultat bool

UserAgent public_oe property

The user agent for the x-mailer
public string UserAgent
Résultat string

Username public_oe property

Username to connect to the mail server.
public string Username
Résultat string