INetMailAddressCollection.AddString

Syntax

AddString(Value: String);

Parameters

Value. The email that should be added to the collection.

NOTE. Email address format must correspond with the address format used in email organization based on the SMTP and POP protocols and must be of the following form: address@mail_domain where address - recipient identifier, and mail_domain - mail server domain name. Example: user@mail.ru.

Description

The AddString method adds the email address passed as a text string to the collection.

Example

To execute the example, add a link to the Net system assembly.

Sub UserProc;
Var
    From_, To_: INetMailAddress;
    CopyTo: INetMailAddressCollection;
    Message: INetMailMessage;
    Client: INetSmtpClient;
Begin
    From_ := New CurlMailAddress.Create("ivanov@server.ru");
    To_ := New CurlMailAddress.Create("petrov@mail.ru");
    Message := New CurlMailMessage.CreateWithFromAndTo(From_, To_);
    Message.Subject := "Test message";
    Message.Body := "message with copies";
    CopyTo := Message.CC;
    CopyTo.AddString("user1@mail.ru");
    CopyTo.AddString("user2@mail.ru");
    Client := New CurlSmtpClient.CreateWithHost("example.server.ru");
    Client.Send(Message);
End Sub UserProc;

After executing the example the message is sent via the specified mail server. The message copy is sent to two addresses: user1@mail.ru and user2@mail.ru.

See also:

INetMailAddressCollection