델파이에서 Indy 컴퍼넌트 중 idMessage와 idSMTP를 이용하면

메일을 간단히 전송할 수 있습니다.


procedure TfrmMain.SendMail;
begin
  with IdMessage do begin
     From.Text                  := 'from@falinux.com';
     ReplyTo.EMailAddresses     := 'replyto@falinux.com';
     Recipients.EMailAddresses  := 'recipients@falinux.com';
     Subject                    := 'subject';
     Priority                   := TIdMessagePriority(mpNormal);
     Body.Text                  := 'Body Text'
     CCList.EMailAddresses      := ''; {CC}
     BccList.EMailAddresses     := ''; {BBC}
  end;
  with IdSMTP do begin
     {Identifies the program that created a message}
     MailAgent := 'MTU1.0';

     {authentication settings}
     AuthenticationType := atLogin;

     UserName := 'user_name';
     Password := 'passwd';
     Host := 'falinux.com'; 
     Port := 25;

     {now we send the message}
     Connect;
     try
        Send(IdMessage);
     finally
        Disconnect;
        IdSMTP.Destroy;
     end;
  end;
end;