Attach images from an entity to en email with formula

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Emmker
    Member
    • Nov 2023
    • 64

    Attach images from an entity to en email with formula

    I have real estate installed.

    When I create an opportunity from a request, I need to automatically send an email to the contact of the opportunity with the description of the property and the images of it to.

    I can compose the email and send it fine with this code:

    PHP Code:
    $to = contact.emailAddress;
    
    ifThen(
             requestId && contactId,
             $emailId = record\create(
    'Email',
    'to', $to,
    'subject', 'Προσφορά Ακινήτου',
    'body', property.description,
    'isHtml', false,
    'status', 'Sending',
    'parentId', id,
    'parentType', 'Opportunity')
    );
    
    ext\email\send($emailId)
    But I cannot think of a way to include the images of the property to,

    I can retrieve the ids the names and the types of the images with property.imagesIds, property.imagesTypes, property.imagesNames,
    but I am stuck as how to make them attachments in the email

    Any Help please?
  • shalmaxb
    Senior Member
    • Mar 2015
    • 1602

    #2
    You can configure a template, where you integrate the images, though this way, the images appear in an HTML Email, not as attachment. If you do not want to place the image directly into the mail body, you can create links to the images beforehand in your entity and send the link, from which the recipient of the mail may download them. In this case, you have to make the images, which are saved in your espoCRM, accessible from outside. This approach would be possible with a free extension: https://github.com/dubas-pro/ext-public-attachment.
    Mind the security questions in this case.

    If you struggle with realizing, I can send you the solution I use, to realize it.

    Comment

    • Emmker
      Member
      • Nov 2023
      • 64

      #3
      Thank you.
      I ll try the extension, but I would prefer the first solution.
      Would you mind sending me your implementation?

      Comment

      Working...