AddString(Value: String);
Value is the email address that needs to be added to the collection.
NOTE. The email address format must conform to the address format used in emailing organization based on the SMTP and POP protocols and must be of the following formaddress@mail_domain, where address - recipient identifier, and mail_domain - mail server domain name. Example: user@mail.ru.
The AddString method adds the email address passed as a text string to the collection.
Sub Main;
Var
From_, To_: INetMailAddress;
CopyTo: INetMailAddressCollection;
Message: INetMailMessage;
Client: INetSmtpClient;
Begin
From_ := New NetMailAddress.Create("ivanov@server.ru");
To_ := New NetMailAddress.Create("petrov@mail.ru");
Message := New NetMailMessage.CreateWithFromAndTo(From_, To_);
Message.Subject := "Test letter";
Message.Body := "letter with copies";
CopyTo := Message.CC;
CopyTo.AddString("user1@mail.ru");
CopyTo.AddString("user2@mail.ru");
Client := New NetSmtpClient.CreateWithHost("example.server.ru");
Client.Send(Message);
End Sub Main;
After executing the example a letter is sent via the specified mail server. The letter copy is sent to two addresses: user1@mail.ru and user2@mail.ru.
See also: