Re: [twsocket] Re Message-Id is not valid, according to RFC 2822

2006-07-19 Thread Arno Garrels
kaythorn wrote:
>>> Is there something I can do to pacify X-Spam?
>> 
>> Remove that space (the one between Roland and Couvela).
> 
> Shall we modify function GenerateMessageID? Something like:
> 
> 
> .but wouldn't it be simpler to use SignOn if it exists, then it
> would be under the control of the application and also match HELO? 

OK, but in TCustomSmtpClient.Helo/Ehlo the FSignOn may not be built
correctly as well, so below is another suggestion, if someone has a 
better idea please post your opinion. What do you think?

---
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html

 

{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
function FixHostName(const S: String): String;   {AG}
var
I, J : Integer;
begin
Result := LowerCase(S);
if Length(Result) = 0 then
begin
Result := '_'; // invalid char, or should we return a syntactically 
correct dummy? 
Exit;
end;
J := 1;
for I := 1 to Length(Result) do begin
if (J = 1) and not(Result[I] in ['a'..'z']) then
Continue;
if (Result[I] in ['-', '.', '0'..'9', 'a'..'z']) then begin
if J <> I then
Result[J] := Result[I];
Inc(J);
end;
end;
SetLength(Result, J - 1);
while (Length(Result) > 0) and (Result[Length(Result)] in ['-', '.']) do
SetLength(Result, Length(Result) - 1);
if Length(Result) = 0 then
Result := '_'; // invalid char, or should we return a syntactically 
correct dummy?
end;

  
{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
function GenerateMessageID(const HostName: String) : String;{AG} 
//param HostName added
begin
Result := FormatDateTime('mmddhhnnsszzz', Now + TimeZoneBiasDT) + '.' +
  IntToHex(Random(32767), 4) + IntToHex(Random(32767), 4) +
  IntToHex(Random(32767), 4) + IntToHex(Random(32767), 4) +
  '@' + HostName;
end;


{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
procedure TCustomSmtpClient.Data; 
[..]
if FSignOn = '' then
FMessageID := GenerateMessageID(FixHostName(LocalHostName))
else
FMessageID := GenerateMessageID(FixHostName(FSignOn));
[..]


{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
procedure TCustomSmtpClient.Helo;
var
I   : Integer;
Buf : String;
begin
FFctPrv := smtpFctHelo;
if FSignOn = '' then
Buf := FixHostname(LocalHostName)
else
Buf := FixHostname(FSignOn);

{ Replace any space by underscore }
{for I := 1 to Length(Buf) do begin
if Buf[I] = ' ' then
Buf[I] := '_';
end;}
ExecAsync(smtpHelo, 'HELO ' + Buf, [250], nil);
end;


{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
procedure TCustomSmtpClient.Ehlo;
var
I   : Integer;
Buf : String;
begin
FAuthTypesSupported.Clear;
FFctPrv := smtpFctEhlo;
if FSignOn = '' then
Buf := FixHostName(LocalHostName)
else
Buf := FixHostName(FSignOn);

{ Replace any space by underscore }
{for I := 1 to Length(Buf) do begin
if Buf[I] = ' ' then
Buf[I] := '_';
end;}
ExecAsync(smtpEhlo, 'EHLO ' + Buf, [250], EhloNext);
end;

 

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Re Message-Id is not valid, according to RFC 2822

2006-07-19 Thread DZ-Jay

On Jul 19, 2006, at 03:52, Arno Garrels wrote:

> kaythorn wrote:
 Is there something I can do to pacify X-Spam?
>>>
>>> Remove that space (the one between Roland and Couvela).
>>
>> Shall we modify function GenerateMessageID? Something like:
>>

I don't think we should modify the function.  X-Spam is the one at 
fault, as *it* does not conform to RFC.  A Message-ID string's 
requirement is that it be universally unique.  To that extent, message 
specific data (e.g. domain name, IP address, etc.) is appended to 
locally unique strings such as timestamps, process IDs, etc; but this 
is just convention.  It may contain any character which is valid in the 
Header values, as defined by RFC 822, which include spaces.  The 
angled-brackets defined the value's delimiter, so there is no need to 
escape or remove spaces, nor any need to argue whether this field or 
that should be the one included in the ID, as its all fair game as long 
as we can guarantee uniqueness.  A very common strategy is to do:

MessageID := '<'
+ Md5Checksum(ServerProcessID) + '$' + 
Md5Checksum(EpochTimestamp)
+ '@' + SenderDomainName
+ '>'

dZ.

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Re Message-Id is not valid, according to RFC 2822

2006-07-19 Thread Arno Garrels
DZ-Jay wrote:
> On Jul 19, 2006, at 03:52, Arno Garrels wrote:
> 
>> kaythorn wrote:
> Is there something I can do to pacify X-Spam?
 
 Remove that space (the one between Roland and Couvela).
>>> 
>>> Shall we modify function GenerateMessageID? Something like:
>>> 
> 
> I don't think we should modify the function.  X-Spam is the one at
> fault, as *it* does not conform to RFC.  

Agreed, so please forget my previous messages, also because
the last change of FSignOn in proc. Helo/Ehlo was indeed bad since
you may for instance helo with an IP as well.

Also the TSmtpCli allows changing the headers including the
message-id, see the MailSnd demo.

---
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html



-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be