针对这个问题需要按下面的方式修改:
事件声明:
procedure SaveToStream(AStream: TStream); overload;
procedure SaveToStream(AStream: TStream; SaveToLocal: Boolean); overload;
事件实现:
procedure TMailEditForm.SaveToStream(AStream: TStream);
begin
SaveToStream(AStream, False);
end;
procedure TMailEditForm.SaveToStream(AStream: TStream; SaveToLocal: Boolean);
var
DateYear: String;
Month: String;
Date: String;
begin
if Pos('@', edtSendTo.Text) <> 0 then
begin
if edtFrom.text <> '' then
msgMail.From := edtFrom.text
else
msgMail.From := DoGetMailFrom;
end
else
msgMail.From := DoGetInternalMailFrom;
msgMail.Subject := edtSubject.Text;
if msgMail.Date = '' then
begin
DateYear := FormatDateTime('dd-yyyy hh:mm:ss',SysUtils.Now);
Month := FormatDateTime('m',SysUtils.Now);
case StrToInt(Month) of
1: Month:='Jan';
2: Month:='Feb';
3: Month:='Mar';
4: Month:='Apr';
5: Month:='May';
6: Month:='Jun';
7: Month:='Jul';
8: Month:='Aug';
9: Month:='Sep';
10: Month:='Oct';
11: Month:='Nov';
12: Month:='Dec';
end;
if SaveToLocal then
msgMail.Date :=Month+ '-'+DateYear
else
msgMail.Date := FormatDateTime('yyyy-mm-dd hh:mm:ss',SysUtils.Now);
end;
CheckName;
msgMail.SendTo := edtSendTo.Text;
msgMail.CC := edtCC.Text;
msgMail.Bcc := edtBcc.Text;
case msgMail.ContentFormatType of
TContentFormatType.ftText : SaveText(AStream);
TContentFormatType.ftHTML : SaveHTML(AStream);
end;
FModified := False;
end; |