Hi, can you, please, help with this?
How to get Mail Sender....
was looking in application/Espo/Services/Email.php and Sender but didn't implement correctly
<?php
namespace Espo\Custom\Hooks\Order;
use Espo\ORM\Entity;
class LinkOrder extends \Espo\Core\Hooks\Base
{
public function beforeSave(Entity $entity)
{
if ($entity->isNew()){
$entityManager = $this->getEntityManager();
if ($entity->get('parentId')){
$sale = $entityManager->getEntity('Sale', $entity->get('parentId'));
$sale->set('orderId',$entity->get('id'));
$entityManager->saveEntity($sale);
}
$email = $entityManager->getEntity('Email');
$email->set(array(
'to' => 'some@email',
'name' => 'subject',
'body' => 'body',
'isHtml' => true
));
$this->getMailSender()->send($email); // I am stucked here, even tried to extends Email service but that didn't go well...
}
}
}
}
?>
How to get Mail Sender....
was looking in application/Espo/Services/Email.php and Sender but didn't implement correctly
<?php
namespace Espo\Custom\Hooks\Order;
use Espo\ORM\Entity;
class LinkOrder extends \Espo\Core\Hooks\Base
{
public function beforeSave(Entity $entity)
{
if ($entity->isNew()){
$entityManager = $this->getEntityManager();
if ($entity->get('parentId')){
$sale = $entityManager->getEntity('Sale', $entity->get('parentId'));
$sale->set('orderId',$entity->get('id'));
$entityManager->saveEntity($sale);
}
$email = $entityManager->getEntity('Email');
$email->set(array(
'to' => 'some@email',
'name' => 'subject',
'body' => 'body',
'isHtml' => true
));
$this->getMailSender()->send($email); // I am stucked here, even tried to extends Email service but that didn't go well...
}
}
}
}
?>
Comment