BxDolAIToolEmailSend.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php defined('BX_DOL') or die('hack attempt');
  2. /**
  3. * Copyright (c) UNA, Inc - https://una.io
  4. * MIT License - https://opensource.org/licenses/MIT
  5. *
  6. * @defgroup UnaCore UNA Core
  7. * @{
  8. */
  9. use NeuronAI\Tools\PropertyType;
  10. use NeuronAI\Tools\ToolProperty;;
  11. class BxDolAIToolEmailSend extends BxDolAITool
  12. {
  13. public function __construct()
  14. {
  15. parent::__construct(
  16. 'email_send',
  17. 'Use this tool to send e-mail.',
  18. );
  19. }
  20. protected function properties(): array
  21. {
  22. return [
  23. new ToolProperty(
  24. name: 'email',
  25. type: PropertyType::STRING,
  26. description: 'Recipient email, one or several comma separated emails.',
  27. required: true
  28. ),
  29. new ToolProperty(
  30. name: 'subject',
  31. type: PropertyType::STRING,
  32. description: 'Mail subject.',
  33. required: true
  34. ),
  35. new ToolProperty(
  36. name: 'body',
  37. type: PropertyType::STRING,
  38. description: 'Mail body.',
  39. required: true
  40. ),
  41. ];
  42. }
  43. public function __invoke(string $email, string $subject, string $body): bool
  44. {
  45. return sendMail($email, $subject, $body);
  46. }
  47. }