Announcement

Collapse
No announcement yet.

Parent of sent email

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

  • Parent of sent email

    I want to set parent to email that was sent from afterSave Hook but it seems not working for some reasons.

    $email->set(array(
    'to' => $emailAddress,
    'from' => '......@....',
    'name' => 'CREATED ORDER No. '. $temp->get('uID'),
    'body' => 'body',
    'parentId' => $temp->get('id'),
    'parentType' => $temp->getEntityType(),

    'isHtml' => true
    ));
    $params = array (
    'fromName' => 'ORDERING SYSTEM'
    );
    $this->getMailSender()->send($email, $params);

    Everything works except email comes with no parent.

  • #2
    Where do you expect to see parent if you sent an email?

    Comment


    • #3
      On email that has been sent. When I receive an email it should have entity (temp) as parent. That's an idea.
      Perfectly fine is an option not to send email but instead to save it. It works but email is not easily found because datesent field is not set.
      Can that field be altered and if can which format it uses (DateTime class, I suppose but what format?)

      Thanks.

      Comment


      • #4
        did you try to save email after you send it?
        $this->getEntityManager()->saveEntity($email);

        Or you can don't send an email. Just set all needed fields. Of course you can set date sent field as well. Format is "Y-m-d H:i:s" in UTC

        Comment


        • #5
          If I save an email after being sent than I got duplicates, one saved and one received without parent.
          I decided to have email sent because of other mail clients, and managed to provide parentid and type through email subject,..in espo email hook deals with subject and parses and updates field accordingly and from espo it's fine,...users that also uses other mail clients to check email will have to deal with extra data in subject

          Comment


          • #6
            you can create an email with this service method
            EspoCRM – Open Source CRM Application. Contribute to espocrm/espocrm development by creating an account on GitHub.


            pass your data, set status as 'Sending' and create entity. But here you can not set fromName parameter

            Comment

            Working...
            X