我想实现的功能是给已知的邮件地址写邮件,用SMTP1实现,但是不知道具体应该怎么样去做!我想请教的是具体都应该设置那个属性,假如我有一个按钮ok,别的东西都用edit输入,单击ok后邮件发送!!
毕业设计马上就结束了,大家帮我啊!!

解决方案 »

  1.   

    不知你的smtp1是什么控件在delphi7.0中,有一組indy控件,
    其中TIdsmtp控件可以發郵件而且很容易實現
      

  2.   

    呵呵
    这个啊,还要钱啊?---------------------------------------------
    procedure TForm11.BtnSendMailClick(Sender: TObject);
    begin
        IdSMTP1.AuthenticationType:=atLogin;
        IdSMTP1.Host:=MailServerCombo.Text;
        IdSMTP1.Port:=25;
        IdMessage1.From.Address:=MailFromEdit.Text;
        IdSMTP1.Username:=MailUsernameEdit.Text;
        IdSMTP1.Password:=MailPasswordEdit.Text;    IdMessage1.Recipients.EMailAddresses:=MailToEdit.Text;    IdMessage1.Subject:=MailSubjectEdit.Text;
        IdMessage1.Body.Text:=MailBodyMemo.Text;    if FileExists(MailAttachmentEdit.Text) then
           TIdAttachment.Create(IdMessage1.MessageParts,MailAttachmentEdit.Text);
           
        try
          try
            BtnSendMail.Enabled:=false;
            IdSMTP1.Connect(1000);
            IdSMTP1.Send(IdMessage1);
            Application.MessageBox('您的邮件已经成功发送到目标邮箱!','成功',mb_ok+mb_iconinformation);
          except on E:Exception do
            StatusBar1.Panels[0].Text:=(E.Message);
          end;
        finally
          if IdSMTP1.Connected then
            IdSMTP1.Disconnect;
          BtnSendMail.Enabled:=True;
        end;
    end;
    ------------------------------------------------------------------------------------------
    你看看,我以前做过的,我的Q:479543842 不懂来问