控件
smtp: TIdSMTP;
MgeSend: TIdMessage;
MgeSend: TIdMessage;
代碼
procedure TForm1.Button1Click(Sender: TObject);
begin
SMTP.Host:='smtp.163.com';
smtp.Username:='[email][email protected][/email]';
smtp.Password:='paswrd';
smtp.Port:=25;
smtp.Connect();
MgeSend.Recipients.EMailAddresses:='[email][email protected][/email]';
MgeSend.From.Text :='[email][email protected][/email]';
MgeSend.Subject:='test';
MgeSend.Body.Text:='發郵件測試';
SMTP.Authenticate;
Smtp.Send(mgeSend);
end;
begin
SMTP.Host:='smtp.163.com';
smtp.Username:='[email][email protected][/email]';
smtp.Password:='paswrd';
smtp.Port:=25;
smtp.Connect();
MgeSend.Recipients.EMailAddresses:='[email][email protected][/email]';
MgeSend.From.Text :='[email][email protected][/email]';
MgeSend.Subject:='test';
MgeSend.Body.Text:='發郵件測試';
SMTP.Authenticate;
Smtp.Send(mgeSend);
end;