#1 2023-01-17 20:01:30

tbo
Member
Registered: 2015-04-20
Posts: 335

function TSMTPConnection.FromText

Function TSMTPConnection.FromText() should be changed as follows:

//  if Split(aText, '@', u, h) then
//  begin
//    if not Split(u, ':', User, Pass) then
//      User := u;
//  end
//  else
//    h := aText;

  h := SplitRight(aText, '@', @u);
  if u <> '' then
  begin
    if not Split(u, ':', User, Pass) then
      User := u;
  end;

With this, the following tests work:

// user='guest@user', pass='123@456', host='mail.test.com', port='25'
var
  con: TSMTPConnection;
begin
  con.FromText('mail.test.com');
  con.FromText('mail.test.com:25');
  con.FromText('guest@user@mail.test.com:25');
  con.FromText('guest@user:123@456@mail.test.com);
  con.FromText('guest@user:123@456@mail.test.com:25');

With best regards
Thomas

Offline

#2 2023-01-18 10:33:51

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,182
Website

Re: function TSMTPConnection.FromText

Nice catch!

Please check https://github.com/synopse/mORMot2/commit/938b8c62

Thanks a lot for the feedback and the fix!

Offline

Board footer

Powered by FluxBB