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