Attachments error: Attachment not in allowed path

Created on 30 January 2025, 2 months ago

I am trying this module to send out email with files as attachment. Everything works file only the attachment is not going through.

Hereby my configuration;

File system: public

Allowed attachment paths:
public://attachments
/sites/default/files/attachments

File system: private

Allowed attachment paths:
private://attachments

Does not matter public or private I am getting the same error: Attachment not in allowed path

I am using Drupal 11.1.1 with php 8.3.15 and mysql 8.

Please let me know what I am doing wrong or missing. Thanks.

πŸ› Bug report
Status

Active

Version

3.0

Component

Miscellaneous

Created by

πŸ‡³πŸ‡±Netherlands a.kahn

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @a.kahn
  • πŸ‡³πŸ‡±Netherlands a.kahn
  • πŸ‡ΊπŸ‡ΈUnited States zengenuity

    You need a wildcard in there, I think. Try:

    public://attachments/*

    or

    private://attachments/*

  • πŸ‡³πŸ‡±Netherlands a.kahn

    Dear zengenuity,

    Thank you for you response and it works with public://attachments/*.

    I was just missing a wildcard * entry.

    So in my environment its like:

    File system: Public
    Allowed attachment paths: public://attachments/*
    Token of Attachment file in template: [easy_email:ReferencedField:entity:attachmentFilename with delta 0] selected through token browser. Hopefully this will help those looking for the same solution.

    Thank you once again for your quick solution.

  • πŸ‡ΊπŸ‡ΈUnited States zengenuity
  • πŸ‡³πŸ‡±Netherlands asman_amin

    Hi a.kahn, thanks for your tip it works indeed.

    On my site it attaches only one file and the other files get skipped. I don't know what I am doing wrong.

    In log messages I get this error:
    Attachment not found: sites/default/files/attachments/file1.pdf, /sites/default/files/attachments/file2.docx

    I am using the token: Attachment type with delta 0

Production build 0.71.5 2024