请老大们给出详细的代码示范如果有更好的控件,请指教

解决方案 »

  1.   

    SMTP: TIdSMTP;var
      AMsg :TIdMessage;
      str:string;
    begin
      AMsg :=TIdMessage.Create(self);
      with AMsg do
      begin
        Body.Text :=str;
        From.Text :='[email protected]';
        Recipients.EMailAddresses := '[email protected]'; 
        Subject := '你好';//标题
        Priority := TIdMessagePriority(1);//优先级 
        CCList.EMailAddresses := '';//抄送 
        BccList.EMailAddresses := '';//暗抄 
        ReceiptRecipient.Text := '[email protected]';//如果需要验证身份的邮件服务器需要Form.text和ReceiptRecipient.Text 一样。
      end;  SMTP.AuthenticationType := atLogin;//这段为设置邮件发送需要身份验证
      SMTP.UserID := '1222';//用户名 
      SMTP.Password := '1234';  SMTP.Host := 'smtp.etang.com'; //发送邮件服务器的地址 
      SMTP.Port := 25; //发送邮件服务器的端口               
      //开始发送。
      SMTP.Connect;
      try
        SMTP.Send(AMsg);
      finally
        SMTP.Disconnect;
      end;
      AMsg.Free();
      str:='';
    end;