Re: multipart/mixed

Giganews Newsgroups
Subject: Re: multipart/mixed
Posted by:  Remy Lebeau \(Indy Team\) (no.spam@no.spam.com)
Date: Tue, 15 Jan 2008

"mitring" <pfracz…@novatic.pl> wrote in message
news:54AB745DD244E340pfracz…@novatic.pl...

> How to create multipart/mixed mail in Indy10

    AMsg := TIdMessage.Create(nil);
    try
        AMsg.Subject := ASubject;
        AMsg.From.Address := AFrom;
        AMsg.Recipients.EmailAddresses := ATo.Text;
        AMsg.CCList.EmailAddresses := ACC.Text;
        AMsg.BccList.EmailAddresses := ABCC.Text;

        if AAttachList.Count > 0 then
        begin
            with TIdText.Create(AMsg.MessageParts, ABody) do
                ContentType := 'text/plain';

            for I := 0 to Pred(AAttachList.Count) do
            begin
                with TIdAttachmentFile.Create(AMsg.MessageParts,
AAttachList.Strings[I]) do
                begin
                    // set properties as needed...
                end;
            end;

            AMsg.ContentType := 'multipart/mixed';
        end else
        begin
            AMsg.Body.Assign(ABody);
            AMsg.ContentType := 'text/plain';
        end;

        // use AMsg as needed ...
    finally
        AMsg.Free
    end;

Gambit

Replies

In response to

multipart/mixed posted by mitring on Tue, 15 Jan 2008