control that lets you send e-mail messages through a standard SMTP
(Simple Mail Transfer Protocol) server with just a few lines of code. Main features
include: ability to attach files of any type (automatically encoded with
Base64), specify sender name, address and reply address, send to multiple
recipients and CC (Carbon Copy) recipients.
Although you can send as many messages as you want, there is
currently a limit of 100 recipients per
message, thus to avoid e-mail spam.
The following tables describe the main properties and events
that you'll have to work with with AXSoft SMTPSock.
String containing the paths of all the local
files to be attached, separated by semicolons (;). If any invalid path is found, it will
be discarded. Wildcards (* or ?) are not allowed. Example: "C:\MyFile.Wav;E:\Documents\File.Doc".
Used to set the body text of the message.
Usually a multi-line string taken from a textbox.
Quite obvious: the message subject/title.
List of recipient e-mail addresses, separated
by semicolons (;). Limited to 100 addresses. Example: "firstname.lastname@example.org;email@example.com".
List of CC (Carbon Coby) recipients, that will
receive the message even if they are not the main recipients. Limited
to 100 addresses, including the regular recipients.
E-mail address you want to receive replies to.
If not specified, SenderEmailAddress is assumed as return address.
The actual e-mail address you are sending mail
Your real name. If left blank,
SenderEmailAddress will be shown instead.
Name or IP address of a standard SMTP (Simple
Mail Transfer Protocol) server you have access to. The server port is assumed to be 25;
should it be different, change it with the Port property.
Starts connection with the server
specified by the Server property.
Closes connection with the server.
Sends the e-mail message described
by the properties: Attachments, MessageBody, MessageSubject, Recipients, Recipients,
RecipientsCC, ReplyEmailAddress, SenderEmailAddress, SenderName. It's pretty obvious that
you must set those properties to relevant values before firing this method.
If you want to get the maximum performance from this
control, you should use the various events it provides. Here is a list.
This event is triggered when the
Connect method succeeds and the control is connected to a standard SMTP server.
Triggered when some kind of error
occours. The Number, Description
and ServerResponse parameters contain informations about the
Occours when the control
successfully disconnects from the server.
Occours during send each time that
and invalid recipient e-mail is encountered: using the EmailAddress
parameter you can notify the user about the wrong address. The user can then decide to
discard the error or to abort the sending. To abort the sending, set the Reset parameter to True.
Triggered when the control has
finished sending the message. You can then proceed with another message of use the
Disconnect method to close the connection.
This event is triggered at regular
intervals during the send process. The two parameters MessageBytesSent
and TotalMessageSize can be used to update, for example, a
The ZIP file of the control contains a HTML reference to the control and a Visual Basic example you can use as a base for
To install, extract the ZIP archive in a custom folder and
run Setup.Exe. In Visual Basic, go to Project>Components and check the line AXSoft SMTPSock 1.72.
Visual Basic Programming Zone is a website by
Lorenzo Dalla Vecchia.
To contact the Webmaster, click here.
Hosted by InWind: www.inwind.it