procedure TMainForm.SpeedButton1Click(Sender: TObject);
begin
NMSMTP1.UserID:='xswgxnn';
NMSMTP1.Host:='Smtp.163.com';//指定邮件服务器地址
NMSMTP1.Port:=25;//端口 Try
if NMSMTP1.Connected then NMSMTP1.Disconnect;
NMSMTP1.Connect;
NMSMTP1.PostMessage.Body.Clear;
NMSMTP1.PostMessage.Attachments.Clear;
NMSMTP1.PostMessage.ToAddress.Clear; NMSMTP1.PostMessage.FromAddress:=MailFrom;//发件人地址
NMSMTP1.PostMessage.FromName:=MailName;//发件人姓名
NMSMTP1.PostMessage.Subject:='测试中'; //邮件主题
NMSMTP1.PostMessage.ToAddress.Add('[email protected]'); //收件人
//正文信息
NMSMTP1.PostMessage.Body.Assign(Memo_EMtext.Lines);
NMSMTP1.SendMail;//发送邮件
end;
if NMSMTP1.Connected then NMSMTP1.Disconnect ;
Gauge1.Visible:=False;
Except
ON E:exception do
Statusbar1.Panels[1].Text:='发送邮件失败!返回错误:'+E.Message;
End;
end;然后总是弹出"5533 you are not authrized to send as <Mail Form:<[email protected]>> authentication is required“ 的信息,这应该是服务器要验证密码!可是密码怎么写?请高手指导!
begin
NMSMTP1.UserID:='xswgxnn';
NMSMTP1.Host:='Smtp.163.com';//指定邮件服务器地址
NMSMTP1.Port:=25;//端口 Try
if NMSMTP1.Connected then NMSMTP1.Disconnect;
NMSMTP1.Connect;
NMSMTP1.PostMessage.Body.Clear;
NMSMTP1.PostMessage.Attachments.Clear;
NMSMTP1.PostMessage.ToAddress.Clear; NMSMTP1.PostMessage.FromAddress:=MailFrom;//发件人地址
NMSMTP1.PostMessage.FromName:=MailName;//发件人姓名
NMSMTP1.PostMessage.Subject:='测试中'; //邮件主题
NMSMTP1.PostMessage.ToAddress.Add('[email protected]'); //收件人
//正文信息
NMSMTP1.PostMessage.Body.Assign(Memo_EMtext.Lines);
NMSMTP1.SendMail;//发送邮件
end;
if NMSMTP1.Connected then NMSMTP1.Disconnect ;
Gauge1.Visible:=False;
Except
ON E:exception do
Statusbar1.Panels[1].Text:='发送邮件失败!返回错误:'+E.Message;
End;
end;然后总是弹出"5533 you are not authrized to send as <Mail Form:<[email protected]>> authentication is required“ 的信息,这应该是服务器要验证密码!可是密码怎么写?请高手指导!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货