写了邮件发送程序,可以发送邮件,但是发送的内容包含很多邮件体信息,具体如下:
Received: from 163.com (unknown [202.108.44.206]) by bjmx2 (Coremail) with SMTP id 38ICsfgdgdfg.1 for ; Sat, 27 Aug 2005 21:49:57 +0800 (CST) X-Originating-IP: [202.108.44.206] Received: from zfgfd (unknown [221.4.182.60]) by smtp3 (Coremail) with SMTP id dgdsgdsfgdsfg2 for ; Sat, 27 Aug 2005 21:49:55 +0800 (CST) X-Originating-IP: [221.4.182.60] From: =?GB2312?B?ztI=?= Subject: dfsadf To: [email protected] Content-Type: multipart/*; charset="GB2312_CHARSET" Reply-To: [email protected] Date: Sat, 27 Aug 2005 21:52:34 +0800 X-Priority: 3 X-Library: Indy 9.00.10 Message-Id: <43106F85.23CDC8.23296> MemoNewMail sdafasdfsafssdafsdaf 但是邮件正文只有最后一行是,而且没有格式了怎么改正才好啊??高手指正一下!!
我用的是IdSMTP和IdMessage,发送程序如下:
begin
if not IdSMTP1.Connected then
begin
if FormConfig.AuthType.Checked then
IdSMTP1.AuthenticationType := atLogin
else
IdSMTP1.AuthenticationType := atNone;
IdSMTP1.Host := FormConfig.EditSMTP.Text;
IdSMTP1.Port := StrToInt(FormConfig.EditSMTPPort.Text);
IdSMTP1.Username := FormConfig.EditUser.Text;
IdSMTP1.Password := FormConfig.MaskEditPw.Text;
IdSMTP1.Connect();
end;
//显示用户信息
StatusBar1.SimpleText := '和服务器已建立连接';
with IdMessage1 do
begin
From.Address := FormConfig.EditReplyTo.Text; //发件人地址
From.Name := FormConfig.EditName.Text;
Recipients.EMailAddresses := EditToAddress.Text; //收件人地址
CCList.EMailAddresses := EditCarbonCopy.Text;
ReplyTo.EMailAddresses := FormConfig.EditReplyTo.Text;
Subject := EditSubject.Text; //邮件主题
CharSet := 'GB2312_CHARSET';
ContentType := 'multipart/*';
Body.Assign(MemoNewMail.Lines); //正文为纯文本的邮件
end; try
IdSMTP1.Send(IdMessage1);
finally
IdSMTP1.Disconnect;
end;
end;
先谢谢了!!!
Received: from 163.com (unknown [202.108.44.206]) by bjmx2 (Coremail) with SMTP id 38ICsfgdgdfg.1 for ; Sat, 27 Aug 2005 21:49:57 +0800 (CST) X-Originating-IP: [202.108.44.206] Received: from zfgfd (unknown [221.4.182.60]) by smtp3 (Coremail) with SMTP id dgdsgdsfgdsfg2 for ; Sat, 27 Aug 2005 21:49:55 +0800 (CST) X-Originating-IP: [221.4.182.60] From: =?GB2312?B?ztI=?= Subject: dfsadf To: [email protected] Content-Type: multipart/*; charset="GB2312_CHARSET" Reply-To: [email protected] Date: Sat, 27 Aug 2005 21:52:34 +0800 X-Priority: 3 X-Library: Indy 9.00.10 Message-Id: <43106F85.23CDC8.23296> MemoNewMail sdafasdfsafssdafsdaf 但是邮件正文只有最后一行是,而且没有格式了怎么改正才好啊??高手指正一下!!
我用的是IdSMTP和IdMessage,发送程序如下:
begin
if not IdSMTP1.Connected then
begin
if FormConfig.AuthType.Checked then
IdSMTP1.AuthenticationType := atLogin
else
IdSMTP1.AuthenticationType := atNone;
IdSMTP1.Host := FormConfig.EditSMTP.Text;
IdSMTP1.Port := StrToInt(FormConfig.EditSMTPPort.Text);
IdSMTP1.Username := FormConfig.EditUser.Text;
IdSMTP1.Password := FormConfig.MaskEditPw.Text;
IdSMTP1.Connect();
end;
//显示用户信息
StatusBar1.SimpleText := '和服务器已建立连接';
with IdMessage1 do
begin
From.Address := FormConfig.EditReplyTo.Text; //发件人地址
From.Name := FormConfig.EditName.Text;
Recipients.EMailAddresses := EditToAddress.Text; //收件人地址
CCList.EMailAddresses := EditCarbonCopy.Text;
ReplyTo.EMailAddresses := FormConfig.EditReplyTo.Text;
Subject := EditSubject.Text; //邮件主题
CharSet := 'GB2312_CHARSET';
ContentType := 'multipart/*';
Body.Assign(MemoNewMail.Lines); //正文为纯文本的邮件
end; try
IdSMTP1.Send(IdMessage1);
finally
IdSMTP1.Disconnect;
end;
end;
先谢谢了!!!
又遇到新问题了:
我在循环发送的时候,怎么只能发送两封,然后开始出现连接错误,我的方式是在循环时改变邮件接受地址就是---循环改变IdMessage1.Recipients.EMailAddresses的值
出问题的地方是:IdSMTP1.Send(IdMessage1);
怎么弄的啊???
怎么搞的呢?