Add: INetMapiAttachment;
The Add method adds a new attachment to the email message.
Sub Main;
Var
Msg: INetMapiMessage;
Client: INetMapiClient;
Attach: INetMapiAttachment;
Begin
Client := New NetMapiClient.Create;
Msg := New NetMapiMessage.Create;
Msg.From_ := "ivanov@server.ru";
Msg.To_.Add("petrov@mail.ru");
Msg.Body := "Photo - Image.bmp";
Msg.Subject := "Photo";
Attach := Msg.Attachments.Add;
Attach.Name := "Photo";
Attach.Path := "c:\Image.bmp";
Client.Message := Msg;
Client.Send;
End Sub Main;
After executing the example the email is sent using the application installed in the operating system and used as a default mail client. The Image.bmp file is attached to the message. This file is named Photo in the attachments list.
See also: