收邮件的时候,收到的内容变成This is a multi-part message in MIME format,
有一些即是这样的:
Content-Type: text/html;
charset="gbk"
Content-Transfer-Encoding: base64PERJVj48aW5jbHVkZXRhaWw+T0vJ87rLPEJSPjwvRElWPjwvaW5jbHVkZXRhaWw+知道是怎么回事吗?是不是需要解编码?
有一些即是这样的:
Content-Type: text/html;
charset="gbk"
Content-Transfer-Encoding: base64PERJVj48aW5jbHVkZXRhaWw+T0vJ87rLPEJSPjwvRElWPjwvaW5jbHVkZXRhaWw+知道是怎么回事吗?是不是需要解编码?
还是你用POP3接收邮件显示的内容???
Body: TIdText;
Attach: TIdAttachmentFile;
begin
msgEMail.Body.Clear;
msgEMail.From.Text := '**'; // 发信人
msgEMail.From.Address := '**'; // 发信地址
msgEMail.Recipients.EMailAddresses := '****'// 收信地址
msgEMail.Subject := '**' // 标题
msgEMail.Encoding := meDefault;
msgEMail.AttachmentEncoding := 'MIME';
msgEMail.ContentTransferEncoding := 'base64';
msgEMail.ContentType := 'multipart/alternative';
msgEMail.CharSet := 'gb2312';
msgEMail.Priority := mpNormal; Body := TIdText.Create(msgEMail.MessageParts, msgEMail.Body); // 正文
Body.ContentType := 'text/html';
Body.ContentTransfer := 'base64';
Body.Body.Text := AContent;
{$IFDEF Delphi14}
Body.CharSet := 'gb2312';
{$ENDIF} for I := 0 to AFilePaths.Count - 1 do begin // 附件
if FileExists(AFilePaths[I]) then begin
Attach := TIdAttachmentFile.Create(msgEMail.MessageParts, AFilePaths[I]);
Attach.ContentType := 'application/octet-stream';
Attach.ContentDisposition := 'attachment';
Attach.ContentTransfer := 'base64';
Attach.FileName := ExtractFileName(AFilePaths[I]);
end;
end; smtpEMail.Send(msgEMail); // 发送邮件
end;
代码未发的十分完整,你看情况改一下吧,基本哪个属性需要设置什么都写的清清楚楚了;
if tmpmsgct > 0 then
for i:= 1 to tmpmsgct do
begin
IdMessage1.Clear;
IdMessage1.MessageParts.Clear;
IdPOP31.Retrieve(i,IdMessage1);
if IdMessage1.NoEncode then
s64realvalue:=IdMessage1.subject
else
s64realvalue:=(uBase64Code.GetMailTitle(IdMessage1.subject));
Memo1.Lines.Add('第'+inttostr(i)+'封'+'标题: '+s64realvalue);
if IdMessage1.Body.Text <>'' then
begin
str := IdMessage1.Body.Text;
Memo2.Lines.Add(str);
end;
end;