SendEmail.dpr 708 B

1234567891011121314151617181920212223242526272829303132
  1. program SendEmail;
  2. {$APPTYPE CONSOLE}
  3. {$R *.res}
  4. uses
  5. System.SysUtils,
  6. Quick.Console,
  7. Quick.SMTP;
  8. var
  9. smtp : TSMTP;
  10. begin
  11. try
  12. smtp := TSMTP.Create('mail.mydomain.com',25,True);
  13. smtp.Username := '[email protected]';
  14. smtp.Password := '1234';
  15. smtp.SendEmail('[email protected]',
  16. 'Test email',
  17. 'A test message',
  18. '[email protected]',
  19. '[email protected]',
  20. '[email protected]',
  21. 'This is the body message');
  22. cout('Press <ENTER> to Exit',ccYellow);
  23. ConsoleWaitForEnterKey;
  24. except
  25. on E: Exception do
  26. Writeln(E.ClassName, ': ', E.Message);
  27. end;
  28. end.