Announcement

Collapse
No announcement yet.

auto send email when creating contact

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • auto send email when creating contact

    I have created a hook to send email to contact automatically after saving contact.
    But email is not sent.
    code in hook:
    <?php

    namespace Espo\Custom\Hooks\Contact;

    use Espo\ORM\Entity;

    class AutoTask extends \Espo\Core\Hooks\Base
    {
    public function beforeSave(Entity $entity, array $options = array())
    {
    //$email = $entity->get('emailAddress');
    //mail($email,'test crm','test');
    $from = 'info@immigrationexam.ca';
    $headers = 'From:' . $from;
    $email = $entity->get('emailAddress');
    //mail($email,'test crm','test');
    $to = 'tolyan64@tut.by';
    mail($to,$from.'test-1',$email,$headers);
    }
    }
    maybe there is another way to do this via crm?
    Thanks in advance
Working...
X