Loading ...
Sorry, an error occurred while loading the content.

Mail2000 1.10.3 -> Suffering from Dementia :-)

Expand Messages
  • gert_nutterts
    Hiyas, Love mail2000 btw, hard to find good programmed material nowadays o well. hmmm It caught my attention that Mail2000 processes every email ( nearly )
    Message 1 of 3 , Aug 3, 2003
    • 0 Attachment
      Hiyas,

      Love mail2000 btw, hard to find good programmed material nowadays o
      well. hmmm

      It caught my attention that Mail2000 processes every email ( nearly )
      flawlessly with the exception of one type of email.

      A notification of instant payment from paypal

      :-) I cannot blame Mail2000 for this sins it is an ishue with Paypal,
      they seem to forget to add a Boundry marker at the end of they're
      email.

      It consists of a email with a content type of ,,
      Multipart/Alternative''

      But it only has 1 part, a plain text part.

      The email literaly ends with the end of that plain text part.

      I think they wanted to send a plain text email but by exident it is
      starting it as a multipart alternative one.

      The function I made some ajustements too is included below.

      The fix I personaly used and works is quite easy.
      If it wants to end... then it will first try to add information
      ( see if the parttext <> nil the usual way, after that if it has ended
      it will just go back ) with normal emails this won't change anything
      about the flow of information.

      If an email is not ,,terminated'' you could say, then this will make
      shure that Mail2000 won't get forgetfull about the part it was working
      on.

      :-) Seems to work for me, It's hot, it's sunday so haven't gone thru
      the entire code yet for a better permanent fix.

      Hope this will help somebody

      Marcello: ;-)if you have any thought about a more permanent solution
      to this unexcepted form of an email, don't hesitate to mail.
      I'm planning on added an updated version after I get all the bugfixes
      and memory leaks out this version ( 1.10.3 )


      As you can see I used the simple way, using 2 labels.

      Heres the code:
      ---------------

      procedure TMailPart.Fill(Data: PChar; HasHeader: Boolean);
      const
      CRLF: array[0..2] of Char = (#13, #10, #0);

      var
      Loop: Integer;
      BoundStart: array[0..99] of Char;
      BoundEnd: array[0..99] of Char;
      InBound: Boolean;
      IsBoundStart: Boolean;
      IsBoundEnd: Boolean;
      BoundStartLen: Integer;
      BoundEndLen: Integer;
      PartText: PChar;
      DataEnd: Boolean;
      MultPart: Boolean;
      NoParts: Boolean;
      InUUCode: Boolean;
      UUFile, UUBound: String;
      Part: TMailPart;
      nPos: Integer;
      nLen: Integer;
      nTL: Integer;
      nSPos: Integer;
      Line: PChar;
      SChar: Char;

      label
      AddData, ResumeData;
      begin

      if (FOwnerMessage = nil) or (not (FOwnerMessage is TMailMessage2000)
      ) then
      begin

      Exception.CreateFmt(_E_MLPT, [Self.Name]);
      Exit;
      end;

      for Loop := 0 to FSubPartList.Count-1 do
      FSubPartList.Items[Loop].Destroy;

      FHeader.Clear;
      FBody.Clear;
      FDecoded.Clear;
      FSubPartList.Clear;
      FIsDecoded := False;
      FEmbedded := False;
      FOwnerMessage.FNeedRebuild := True;
      FOwnerMessage.FNeedNormalize := True;
      FOwnerMessage.FNeedFindParts := True;

      nPos := -1;
      DataEnd := False;
      nTL := StrLen(Data);
      nSPos := nTL+1;

      if (Self is TMailMessage2000) and Assigned(FOwnerMessage.
      FOnProgress) then
      begin

      FOwnerMessage.FOnProgress(Self, nTL, 0);
      Application.ProcessMessages;
      end;

      if HasHeader then
      begin

      // Get Header

      DataLinePChar(Data, nTL, nPos, nLen, Line, DataEnd);

      while not DataEnd do
      begin

      if nLen = 0 then
      begin

      Break;
      end
      else
      begin

      if (Line[0] in [#9, #32]) and (FHeader.Count > 0) then
      begin

      FHeader[FHeader.Count-1] := FHeader[FHeader.Count-1] + #32 +
      TrimLeftSpace(String(PChar(@Line[1])));
      end
      else
      begin

      FHeader.Add(String(Line));
      end;
      end;

      DataLinePChar(Data, nTL, nPos, nLen, Line, DataEnd);

      if (Self is TMailMessage2000) and Assigned(FOwnerMessage.
      FOnProgress) then
      begin

      FOwnerMessage.FOnProgress(Self, nTL, nPos+1);
      Application.ProcessMessages;
      end;
      end;

      for Loop := 0 to FHeader.Count-1 do
      FHeader[Loop] := NormalizeLabel(FHeader[Loop]);
      end;

      MultPart := LowerCase(Copy(GetLabelValue(_C_T), 1, 10)) = _MP;
      InBound := False;
      IsBoundStart := False;
      IsBoundEnd := False;
      UUBound := '';

      if MultPart then
      begin

      StrPCopy(BoundStart, '--'+GetBoundary);
      StrPCopy(BoundEnd, '--'+GetBoundary+'--');
      BoundStartLen := StrLen(BoundStart);
      BoundEndLen := StrLen(BoundEnd);
      NoParts := False;
      end
      else
      begin

      if LabelExists(_C_T) then
      begin

      NoParts := True;
      BoundStartLen := 0;
      BoundEndLen := 0;
      end
      else
      begin

      StrPCopy(BoundStart, _UUBG);
      StrPCopy(BoundEnd, _UUEN);
      BoundStartLen := StrLen(BoundStart);
      BoundEndLen := StrLen(BoundEnd);
      NoParts := False;
      end;
      end;

      PartText := nil;

      // Get Body

      DataLinePChar(Data, nTL, nPos, nLen, Line, DataEnd);

      while (not DataEnd) and (not InBound) do
      begin

      if (not NoParts) and (((Line[0] = '-') and (Line[1] = '-')) or
      ((Line[0] = 'b') and (Line[1] = 'e'))) then
      begin

      IsBoundStart := StrLComp(Line, BoundStart, BoundStartLen) = 0;
      end;

      if NoParts or (not IsBoundStart) then
      begin

      if PartText = nil then
      begin

      PartText := Line;
      nSPos := nPos;
      end;

      DataLinePChar(Data, nTL, nPos, nLen, Line, DataEnd);

      if (Self is TMailMessage2000) and Assigned(FOwnerMessage.
      FOnProgress) then
      begin

      FOwnerMessage.FOnProgress(Self, nTL, nPos+1);
      Application.ProcessMessages;
      end;
      end
      else
      begin

      InBound := True;
      end;
      end;

      if nPos > nSPos then
      begin

      SChar := Data[nPos];
      Data[nPos] := #0;

      if PartText <> nil then
      FBody.Write(PartText[0], nPos-nSPos);

      Data[nPos] := SChar;
      end;

      if not NoParts then
      begin

      PartText := nil;

      if MultPart then
      begin

      // Get Mime parts

      while not DataEnd do
      begin

      if IsBoundStart or IsBoundEnd then
      begin
      AddData:
      if (PartText <> nil) and (PartText[0] <> #0) then
      begin

      Part := TMailPart.Create(Self.FOwnerMessage);
      Part.FOwnerPart := Self;
      Part.FOwnerMessage := Self.FOwnerMessage;

      SChar := Data[nPos-2];
      Data[nPos-2] := #0;
      Part.Fill(PartText, True);
      Data[nPos-2] := SChar;

      Part.FParentBoundary := GetBoundary;
      FSubPartList.Add(Part);
      PartText := nil;
      if DataEnd then goto ResumeData;
      end else if DataEnd then goto ResumeData;

      if IsBoundEnd then
      begin
      Break;
      end;

      IsBoundStart := False;
      IsBoundEnd := False;
      end
      else
      begin

      if PartText = nil then
      begin

      PartText := Line;
      end;
      end;

      DataLinePChar(Data, nTL, nPos, nLen, Line, DataEnd);
      If DataEnd then begin
      Goto AddData;
      ResumeData:
      end;


      if (Self is TMailMessage2000) and Assigned(FOwnerMessage.
      FOnProgress) then
      begin

      FOwnerMessage.FOnProgress(Self, nTL, nPos+1);
      Application.ProcessMessages;
      end;

      if not DataEnd then
      begin

      if (Line[0] = '-') and (Line[1] = '-') then
      begin

      IsBoundStart := StrLComp(Line, BoundStart, BoundStartLen)
      = 0;

      if not IsBoundStart then
      begin

      IsBoundEnd := StrLComp(Line, BoundEnd, BoundEndLen) = 0;
      end;
      end;
      end;
      end;
      end
      else
      begin

      // Get UUCode parts

      InUUCode := IsBoundStart;

      while not DataEnd do
      begin

      if IsBoundStart then
      begin

      if UUBound = '' then
      begin

      GetMem(PartText, FBody.Size+1);
      UUBound := GenerateBoundary;
      StrLCopy(PartText, FBody.Memory, FBody.Size);
      PartText[FBody.Size] := #0;

      Part := TMailPart.Create(Self.FOwnerMessage);
      Part.FOwnerPart := Self;
      Part.FOwnerMessage := Self.FOwnerMessage;
      Part.Fill(PChar(EncodeQuotedPrintable(String(PartText),
      False)), False);
      Part.FParentBoundary := UUBound;
      Part.SetLabelValue(_C_T, _T_P);
      Part.SetLabelParamValue(_C_T, _CSET, '"'+FOwnerMessage.
      FCharset+'"');
      Part.SetLabelValue(_C_TE, _E_QP);

      FSubPartList.Add(Part);
      SetLabelValue(_C_T, '');
      SetLabelValue(_C_T, _M_M);
      SetLabelParamValue(_C_T, _BDRY, '"'+UUBound+'"');

      FreeMem(PartText);
      end;

      PartText := nil;
      IsBoundStart := False;
      UUFile := TrimSpace(Copy(String(Line), 11, 999));
      end
      else
      begin

      if IsBoundEnd then
      begin

      Part := TMailPart.Create(Self.FOwnerMessage);
      Part.FOwnerPart := Self;
      Part.FOwnerMessage := Self.FOwnerMessage;

      SChar := Data[nPos-2];
      Data[nPos-2] := #0;
      DecodeUUCODE(PartText, Part.FDecoded);
      Data[nPos-2] := SChar;

      Part.EncodeBinary;
      Part.FParentBoundary := UUBound;
      Part.SetLabelValue(_C_T, GetMimeType(UUFile));
      Part.SetLabelValue(_C_TE, _E_BA);
      Part.SetLabelValue(_C_D, _ATCH);
      Part.SetLabelParamValue(_C_T, _NAME,
      '"'+EncodeLine7Bit(UUFile, FOwnerMessage.FCharSet)+'"');
      Part.SetLabelParamValue(_C_D, _FLNM,
      '"'+EncodeLine7Bit(UUFile, FOwnerMessage.FCharSet)+'"');
      Part.SetLabelValue(_XM2A, '"'+EncodeLine7Bit(UUFile,
      FOwnerMessage.FCharSet)+'"');
      Part.SetLabelParamValue(_XM2A, _EMBD, 'no');

      FSubPartList.Add(Part);
      PartText := nil;
      IsBoundEnd := False;
      end
      else
      begin

      if PartText = nil then
      begin

      PartText := Line;
      end;
      end;
      end;

      DataLinePChar(Data, nTL, nPos, nLen, Line, DataEnd);

      if (Self is TMailMessage2000) and Assigned(FOwnerMessage.
      FOnProgress) then
      begin

      FOwnerMessage.FOnProgress(Self, nTL, nPos+1);
      Application.ProcessMessages;
      end;

      if not DataEnd then
      begin

      if (Line[0] = 'b') and (Line[1] = 'e') then
      begin

      IsBoundStart := StrLComp(Line, BoundStart, BoundStartLen)
      = 0;
      InUUCode := True;
      end;

      if (not IsBoundStart) and InUUCode then
      begin

      if (Line[0] = 'e') and (Line[1] = 'n') and (Line[2] = 'd')
      then
      begin

      IsBoundEnd := True;
      InUUCode := False;
      end;
      end;
      end;
      end;
      end;
      end;

      if (Self is TMailMessage2000) and Assigned(FOwnerMessage.
      FOnProgress) then
      begin

      FOwnerMessage.FOnProgress(Self, nTL, nTL);
      Application.ProcessMessages;
      end;
      end;
    • Bianco.poa
      Until how many e-mails I can send in an only time? 1024? tank s Bianco
      Message 2 of 3 , Jan 8, 2004
      • 0 Attachment
        Until how many e-mails I can send in an only time? 1024?
           tank's
         
          Bianco 
      • Kunikazu OKADA
        ... 100 recipients is the minimum number of recipients to be supported by an SMTP server ##### according to RFC 821 ##### recipients buffer The maximum total
        Message 3 of 3 , Jan 10, 2004
        • 0 Attachment
          > Until how many e-mails I can send in an only time? 1024?
          > tank's

          100 recipients is the minimum number of recipients to be
          supported by an SMTP server


          ##### according to RFC 821 #####

          recipients buffer

          The maximum total number of recipients that must be
          buffered is 100 recipients.

          ****************************************************
          * *
          * TO THE MAXIMUM EXTENT POSSIBLE, IMPLEMENTATION *
          * TECHNIQUES WHICH IMPOSE NO LIMITS ON THE LENGTH *
          * OF THESE OBJECTS SHOULD BE USED. *
          * *
          ****************************************************

          ##### end #####

          As most of modern SMTP server implementation can handle more
          recipients than 100 , it depends on your target SMTP server.
        Your message has been successfully submitted and would be delivered to recipients shortly.