RandomClear icon

How to send arbitrary e-mail with file attaches

RandomClear | PRO | 02/12/13 04:38:51 AM UTC | 0 ⭐ | 642 👁️ | Never ⏰ | []
Delphi |

810 B

|

None

|

0 👍

/

0 👎

// See also: http://pastebin.com/3Q1ykdSH - "how to send feedback instead of bug report"
// See also: http://pastebin.com/jxKB2WDZ - "how to send arbitrary data to bug tracker"
 
// This code will work in any project - even without EurekaLog active
 
uses
  ETypes, ESendMail, ESendMailSMAPI;
 
procedure TForm1.Button1Click(Sender: TObject);
var
  Files: TStringList;
begin
  Files := TStringList.Create;
  try
    Files.Add('C:\FileToAttach1.txt');
    Files.Add('C:\FileToAttach2.zip');
    EurekaLogSendEmail(esmSimpleMAPI, '', '[email protected]', 'Subject', 'Body', '', '', '', 0, Files);
 
    // A similar construct is possible with any other e-mail send method (client, server, MAPI), except Shell/mailto.
    // Simply pass Files as AAttachments argument.
  finally
    FreeAndNil(Files);
  end;
end;

Comments