delphi7使用Indy的smtp server发送邮件

VAR SMTP : TIdSMTP;VAR MSG : TIdMSG;.. MSG:=TIdMSG.Create(NIL);TRYWITH MSG.Recipients.Add DOBEGIN Name:='<Name of recipient>'; Address:='<Email address of recipient>'END; MSG.BccList.Add.Address:='<Email address of Blind Copy recipient>'; MSG.From.Name:='<Name of sender>'; MSG.From.Address:='<Email address of sender>'; MSG.Body.Text:='<Message Body>'; MSG.Subject:='<Subject of message>'; SMTP:=TIdSMTP.Create(NIL);TRY SMTP.Host:='x.x.x.x';// IP Address of SMTP server SMTP.Port:=25;// Port address of SMTP service (usually 25) SMTP.Connect;TRY SMTP.Send(MSG)FINALLY SMTP.Disconnect ENDFINALLY SMTP.Free ENDFINALLY MSG.Free END;

你可能感兴趣的:(Delphi)