Announcement

Collapse
No announcement yet.

Email attachment sent to controller but missing in Email

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

  • Email attachment sent to controller but missing in Email

    Hello,

    I come across trouble regarding sending attachment through email.
    I generate a PDF from an Opportunity and PDF is saved.
    When I create an email, if I download the generated PDF on my computer and add it with the Attach file and browse a file, Email is successfully sent with the attachment.

    However, if I select choose an attachment and pick my PDF from the list on the right hand side, I do not receive the attachment.

    Regarding the Role permissions, I set Attachment, Document with full permission to all objects.
    I also added on the Field Permission the Email -> attachment to yes/yes.

    If I use the browser's console, I can see the request sent while clicking "Send Email" contains the following in the JSON :

    Code:
    "attachmentsIds":["5e3a986168e8c0acd"],
    "attachmentsTypes":{},
    "attachmentsNames":{"5e3a986168e8c0acd":"attachment.pdf"}
    If I browse my database directly, in the Attachment table, I can see a line with this ID, right name and type = application/pdf.
    Also, when I send the email, the Parent_type of the attachment is changed to Email and the parent_id is changed to the Email ID. Which make me think the attachment part is working.

    But in the browser's console, the following data is returned by the Email controller in the response:
    Code:
    "attachmentsTypes":{}
    "attachmentsIds":[],
    "attachmentsNames":{}
    "hasAttachment":true
    There is nothing logged into /data/logs/espo-2020-02-23.log nor /var/log/apache2/error.log

    permission on the /data/upload folder containing the attachments (I checked, file with ID is there, if I download it and add pdf extension file is working) :
    -rw-rw-r-- 1 www-data www-data

    Is what file can I check what is done and why the request has attachment with a correct and existing IDm file is present in data/upload and in the DB but the server returns an empty attachment response ?

    Any lead would be appreciated.

    Regards,
    Chris

  • #2
    Hi Chis,

    I would debug the sending functions to find out in what place attachments are lost.

    https://github.com/espocrm/espocrm/b...Email.php#L156

    https://github.com/espocrm/espocrm/b...ender.php#L181

    Comment

    Working...
    X