Add Method (SMTPRelayServers collection)

Dundas

Add Method (SMTPRelayServers collection)

Adds an SMTPRelayServer object to the SMTPRelayServers collection.

Syntax

SMTPRelayServersCollection.Add (Name as string, [Port as long = 25, LocalHost as string = "local.com", User as string = "", Password as string = ""])

The Add method syntax has the following parts:

Part

Description

Name

The name of the SMTP server, or its corresponding IP address.

Port

The port to use when connecting to the server. Defaults to 25.

LocalHost

The local computer's name or its IP address. Used with the HELO command, this defaults to "local.com".

User

A valid username if the NNTP server requires authentication.  ONLY applies to NNTP servers!

Password

The password corresponding to the supplied username (if the NNTP server requires authentication).  ONLY applies to NNTP servers!

  Remarks

Use this method to add an SMTPRelayServer object to the SMTPRelayServers collection. To remove an object use the Remove method. To remove all objects from the collection call the Clear method.

If the specified server requires authentication then you must supply a valid username and password. However, most SMTP servers do not require authentication.

If you specify more than one (1) server then the first server in this collection will be used to send the email. However, if this server is down then the next server in the collection will be used to send the email, and so on. Specifying more than one server increases the chances of successfully sending your email, and using a relay server is also faster than sending the message directly.

You can set an optional value without having to provide values for previous optional arguments by separating the arguments with commas. For example, to provide a username and password you could call the Add method with the following syntax: SMTPRelayServersCollection.Add "someserver.com",,,"MyUsername","MyPassword".

NOTE: The username and password parameters are only implemented for NNTP servers.  If you need to implement a username/password for an SMTP server you will have to purchase the source code to the Mailer control.

See Also: SMTPRelayServers Collection | Clear Method | Count Property | Item Method | Remove Method