AXSoft SMTPSock
By: AXSoft Date: 10/07/2001
File:

axs_smtpsock.zip

Size:

186 KB

Download now!

Great free 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.

Property Desription
Attachments 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".
MessageBody Used to set the body text of the message. Usually a multi-line string taken from a textbox.
MessageSubject Quite obvious: the message subject/title.
Recipients List of recipient e-mail addresses, separated by semicolons (;). Limited to 100 addresses. Example: "me@here.com;you@there.net".
RecipientsCC 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.
ReplyEmailAddress E-mail address you want to receive replies to. If not specified, SenderEmailAddress is assumed as return address.
SenderEmailAddress The actual e-mail address you are sending mail from.
SenderName Your real name. If left blank, SenderEmailAddress will be shown instead.
Server 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.

Method Desription
Connect Starts connection with the server specified by the Server property.
Disconnect Closes connection with the server.
SendMail 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.

Event Desription
Connected This event is triggered when the Connect method succeeds and the control is connected to a standard SMTP server.
Error Triggered when some kind of error occours. The Number, Description and ServerResponse parameters contain informations about the error.
Disconnected Occours when the control successfully disconnects from the server.
InvalidRecipient 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.
MailSendComplete 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.
MessageProgress 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 progress bar.

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 your programs.

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.

Click Here!


Visual Basic Programming Zone is a website by Lorenzo Dalla Vecchia.
To contact the Webmaster, click here.
Hosted by InWind: www.inwind.it