Advertisement
RandomClear

How to send arbitrary e-mail with file attaches

Feb 11th, 2013
353
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.81 KB | None | 0 0
  1. // See also: http://pastebin.com/3Q1ykdSH - "how to send feedback instead of bug report"
  2. // See also: http://pastebin.com/jxKB2WDZ - "how to send arbitrary data to bug tracker"
  3.  
  4. // This code will work in any project - even without EurekaLog active
  5.  
  6. uses
  7.   ETypes, ESendMail, ESendMailSMAPI;
  8.  
  9. procedure TForm1.Button1Click(Sender: TObject);
  10. var
  11.   Files: TStringList;
  12. begin
  13.   Files := TStringList.Create;
  14.   try
  15.     Files.Add('C:\FileToAttach1.txt');
  16.     Files.Add('C:\FileToAttach2.zip');
  17.     EurekaLogSendEmail(esmSimpleMAPI, '', 'to-email@example.com', 'Subject', 'Body', '', '', '', 0, Files);
  18.  
  19.     // A similar construct is possible with any other e-mail send method (client, server, MAPI), except Shell/mailto.
  20.     // Simply pass Files as AAttachments argument.
  21.   finally
  22.     FreeAndNil(Files);
  23.   end;
  24. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement