Saving mail attachments

Check also Build New Mail Message

procedure TForm1.btnLoadClick(Sender: TObject);  
begin  
  if not OpenDialog1.Execute() then Exit;  
  clMailMessage1.LoadMessage(OpenDialog1.FileName);
end;   
 
procedure TForm1.clMailMessage1SaveAttachment(Sender: TObject;  
  ABody: TclAttachmentBody; const AFileName: string;
  var AData: TStream; var Handled: Boolean);  
begin  
  SaveDialog1.FileName := AFileName;  
  Handled := SaveDialog1.Execute();  
 
  if not Handled then Exit;  
 
  AData := TFileStream.Create(SaveDialog1.FileName, fmCreate);
end;

Add Feedback