Board index » delphi » Feature request on TIdSMTP

Feature request on TIdSMTP

i would like to see the posibility to send a TIdMessage to other users than
specified in the message.
therefore the send-method needs to be changed to

procedure TIdSMTP.Send(AMsg: TIdMessage; const MsgTo:string='');
or
procedure TIdSMTP.Send(AMsg: TIdMessage; const
MsgTo:TIdEmailAddressList=nil);
or another method needs to be added.

(
the implementation would be something like:

  if msgTo=nil then
  begin
  WriteRecipients(AMsg.Recipients);
  WriteRecipients(AMsg.CCList);
  WriteRecipients(AMsg.BccList);
  end else WriteRecipients(MsgTo);

)

thank you,

Bas Gooijen

 

Re:Feature request on TIdSMTP


WHY ????
"Bas Gooijen" <bas_gooi...@yahoo.com> schrieb im Newsbeitrag
news:3cbe96e0$1_1@dnews...
Quote
> i would like to see the posibility to send a TIdMessage to other users
than
> specified in the message.
> therefore the send-method needs to be changed to

> procedure TIdSMTP.Send(AMsg: TIdMessage; const MsgTo:string='');
> or
> procedure TIdSMTP.Send(AMsg: TIdMessage; const
> MsgTo:TIdEmailAddressList=nil);
> or another method needs to be added.

> (
> the implementation would be something like:

>   if msgTo=nil then
>   begin
>   WriteRecipients(AMsg.Recipients);
>   WriteRecipients(AMsg.CCList);
>   WriteRecipients(AMsg.BccList);
>   end else WriteRecipients(MsgTo);

> )

> thank you,

> Bas Gooijen

Re:Feature request on TIdSMTP


becourse it then would be possible to relay or forward a message, without
changing it.

--

Bas Gooijen

Quote
"Ernst Gerlach" <ernst.gerl...@epost.de> wrote in message

news:3cbf1c26$1_1@dnews...
Quote
> WHY ????
> "Bas Gooijen" <bas_gooi...@yahoo.com> schrieb im Newsbeitrag
> news:3cbe96e0$1_1@dnews...
> > i would like to see the posibility to send a TIdMessage to other users
> than
> > specified in the message.
> > therefore the send-method needs to be changed to

> > procedure TIdSMTP.Send(AMsg: TIdMessage; const MsgTo:string='');
> > or
> > procedure TIdSMTP.Send(AMsg: TIdMessage; const
> > MsgTo:TIdEmailAddressList=nil);
> > or another method needs to be added.

> > (
> > the implementation would be something like:

> >   if msgTo=nil then
> >   begin
> >   WriteRecipients(AMsg.Recipients);
> >   WriteRecipients(AMsg.CCList);
> >   WriteRecipients(AMsg.BccList);
> >   end else WriteRecipients(MsgTo);

> > )

> > thank you,

> > Bas Gooijen

Re:Feature request on TIdSMTP


"Bas Gooijen" <bas_gooi...@yahoo.com> schrieb im Newsbeitrag
news:3cbf4acf$1_2@dnews...
Quote
> becourse it then would be possible to relay or forward a message, without
> changing it.

If you want nothing to change, do something like the following from my V50.
The TidMessage and Tidsmtp
is not designed to do so.:
------------------------------------
unit IdServSMTPCli;

interface

uses
  Classes,
  IdSMTP,
  IdNNTP;

type
  TIdServSMTPCli = class (TidSMTP)
  protected

  public
    DerAbsender : string;
    DieEmpfaenger, DerHeader, DerBody : TStrings;

    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
    function SendX: integer; virtual;
  end;
{
SendX Fehler: 1 = Absender, 2 = ein Empf?nger 3 = kein gltiger Empf?nger
4 = es werden keine Nutzdaten angenommen

Quote
}

  TidNNTPGe = class(TIdNNTP)

  public
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
    function SelectGroupGe(const AGroup: string) : boolean;
  end;

implementation

{uses
  IdCoder3To4,
  IdGlobal,
  IdResourceStrings,
  SysUtils;  }

{ TidNNTP }

constructor TidNNTPGe.Create(AOwner: TComponent);
begin
  inherited;
end;

destructor TidNNTPGe.Destroy;
begin
  inherited;
end;

function TidNNTPGe.SelectGroupGe(const AGroup: string) : boolean;
begin
  Result := true;
  try
    SelectGroup(AGroup);
  except
    Result := false;
  end;
end;

{ TIdSMTP }

constructor TIdServSMTPCli.Create(AOwner: TComponent);
begin
  inherited;
  DieEmpfaenger := TStringList.Create;
  DerHeader     := TStringList.Create;
  DerBody       := TStringList.Create;
end;

destructor TIdServSMTPCli.Destroy;
begin
  DieEmpfaenger.Free;
  DieEmpfaenger := NIL;
  DerHeader.Free;
  DerHeader := NIL;
  DerBody.Free;
  DerBody := NIL;
  inherited;
end;

function TIdServSMTPCli.SendX: integer;
var
  ok: boolean;

  procedure WriteRecipient ( const AEmailAddress: String );
  begin
    try
      SendCmd ( 'RCPT TO:<' + AEMailAddress + '>', 250 );
      ok := true;
    except
      Result := 2;
    end;
  end;

  procedure WriteRecipients(AList: TStrings);
  var
    i: integer;
  begin
    for i := 0 to AList.count - 1 do
    begin
      if (pos('@', AList[i]) > 0) then
      WriteRecipient ( AList [ i ] );
    end;
  end;

  Function NeedToAuthenticate : Boolean;
  begin
    if FAuthenticationType <> atNone then
    begin
      Result := IsAuthProtocolAvailable ( FAuthenticationType )
        and ( FDidAuthenticate = False );
    end
    else
    begin
      Result := False;
    end;
  end;

begin
  Result := 0;
  SendCmd( 'Rset');
  if  NeedToAuthenticate then
  begin
    Authenticate;
  end;
  try
    SendCmd( 'Mail from:<' + DerAbsender + '>', 250);
  except
    Result := 1;
    Exit;
  end;
  ok := false;
  WriteRecipients(DieEmpfaenger);
  if not ok then begin
    Result := 3;
    Exit;
  end;
  try
    SendCmd( 'Data', 354 );
  except
    Result := 4;
    Exit;
  end;
  WriteStrings(DerHeader);
  WriteLn('');
  WriteStrings(DerBody);
  SendCmd( '.', 250);
  DieEmpfaenger.Clear;
  DerHeader.Clear;
  DerBody.Clear;
end;

end.
----------------------------------------
I send you a copy by mail, have a look into the header.

regards

Ernst Gerlach
http://www.gerlach-mtl.de/
i...@gerlach-mtl.de

Other Threads