Smtp Html Attachments

Giganews Newsgroups
Subject: Smtp Html Attachments
Posted by:  W. Prinzjakowitsch (c_e…@web.de)
Date: Wed, 18 Jun 2008

Hi community,
my problem is that every attachment works well except for JPGs. When I
attach a JPG file i get the error *connection reset by peer* and no mail
is sent.
If i do not send HTML but plaintext it works with JPGs.
Anybody knows whats wrong?

      // PlainText, HTML, normal attachments, no HTML-related
attachments
      if bPlainText and bAttachments and (not bRelatedAtt) then
      begin
        with TIdText.Create(IndyMessage.MessageParts, nil) do
        begin
          ContentType := 'multipart/alternative';
        end;

        with TIdText.Create(IndyMessage.MessageParts, nil) do
        begin
          Body.Text := sBody;
          ContentType := 'text/plain';
          ParentPart := 0;
        end;

        with TIdText.Create(IndyMessage.MessageParts, nil) do
        begin
          Body.Text := sHtmlBody;
          ContentType := 'text/html';
          ParentPart := 0;
        end;

        for i := 0 to slAttachments.Count-1 do
        begin
          with TIdAttachmentFile.Create(IndyMessage.MessageParts,
slAttachments[i]) do
          begin
            FileName          := ExtractFileName(slAttachments[i]);
            ContentTransfer    := 'base64';
            ContentDisposition := 'attachment';
            ParentPart        := -1;
          end;
        end;  // for i := 0 to slAttaments.Count-1 do

        IndyMessage.ContentType := 'multipart/mixed';
        IndyMessage.IsEncoded  := True;
      end;  // if bPlainText and bAttachments and (not bRelatedAtt) then

Thanks for anything to point me in the right direction!!

W.

Replies