Einzelnen Beitrag anzeigen

Benutzerbild von dataspider
dataspider

Registriert seit: 9. Nov 2003
Ort: 04539 Groitzsch
1.351 Beiträge
 
Delphi 11 Alexandria
 
#7

AW: Lotus Notes OLE web.de/gmx Zustellungsfehler 554

  Alt 10. Jun 2020, 09:26
Lotus Script nutzt sicher die selben DLL' s wie OLE.

Vielleicht hilft es dir ja:

Delphi-Quellcode:
procedure TLotusNotesMail.BuildMail;
Var
  MailMain: IMIMEEntity;
  MailParent: IMIMEEntity;
  MailBody: IMIMEEntity;
  BodyStream: INotesStream;
  MimeHeader: IMIMEHeader;
  i: Integer;

  procedure AddHeader(const AEntity: IMIMEEntity; const AHeaderName,
      AHeaderValue: string; const AEncode: Boolean = False);
  begin
    MimeHeader := AEntity.CreateHeader(AHeaderName);
    if AEncode then
      MimeHeader.SetHeaderVal(EncodeHeader(AHeaderValue, '', 'Q', 'ISO-8859-15'))
    else
      MimeHeader.SetHeaderVal(AHeaderValue);
  end;

  procedure SetToHeader(const AName, AValue: string);
  begin
    FDocument.ReplaceItemValue(AName, EncodeHeader(AValue, '', 'Q', 'ISO-8859-15'));
    //FDocument.ReplaceItemValue(AName, AValue);
  end;

begin

  LNSession.ConvertMime := False;
  FDocument := FLNDataBase.CreateDocument;
  FDocument.ReplaceItemValue('From', LNSession.EffectiveUserName);
  FDocument.ReplaceItemValue('Principal', LNSession.EffectiveUserName);
  // Hauptblock
  MailMain := FDocument.CreateMIMEEntity(sBody);
  AddHeader(MailMain, SContentType, CONTENTTYPE_MULTIPART_MIXED);

  // Hier die Änderungen von MIME zu Document
  if (Mail.SendTo <> '') then
    SetToHeader(STo, Mail.SendTo);
    //AddHeader(MailMain, STo, Mail.SendTo);
  if (Mail.ToAddresses <> '') then
    SetToHeader(STo, Mail.ToAddresses);
    //AddHeader(MailMain, STo, Mail.ToAddresses, True);
  if (Mail.CcAddresses <> '') then
    SetToHeader(SCc, Mail.CCAddresses);
    //AddHeader(MailMain, SCc, Mail.CcAddresses, True);
  if (Mail.BccAddresses <> '') then
    SetToHeader(SBCc, Mail.BccAddresses);
    //AddHeader(MailMain, SBcc, Mail.BccAddresses, True);

  SetToHeader('Recipients', Mail.Recipients);

  //AddHeader(MailMain, SSubject, Mail.Subject, True);
  FDocument.ReplaceItemValue(SSubject, Mail.Subject);

  // Parent Entity
  MailParent := MailMain.CreateChildEntity(nil);
  AddHeader(MailParent, SContentType, CONTENTTYPE_MULTIPART_RELATED);

  // Body
  EncodeBodyText;
  MailBody := MailParent.CreateChildEntity(nil);

  BodyStream := FLNSession.CreateStream;
  BodyStream.WriteText(FBodyText.Text, EOL_CRLF);
  BodyStream.WriteText('<br><br>', EOL_CRLF);

  MailBody.SetContentFromText(BodyStream, STextHtml, ENC_QUOTED_PRINTABLE);
  MailBody.EncodeContent(ENC_QUOTED_PRINTABLE);

  BodyStream.Close;
  BodyStream.Truncate;
  BodyStream := nil;

  // Files
  for i := 0 to Mail.Attachments.Count - 1 do
     AttachFile(MailMain, Mail.Attachments.Strings[i]);

  for i := 0 to Mail.InlineImages.Count - 1 do
    WriteInlineImage(MailParent, Mail.InlineImages.Items[I]);

  MimeHeader := nil;
  MailParent := nil;
  MailBody := nil;
  MailMain := nil;
end;
Frank
Frank Reim
  Mit Zitat antworten Zitat