email on payment - exclude attachments/pdf

Version 5.13.22 | Environment Docker

Question: is it possible to deactivate the attachment of PDFs within payment mails? I don’t want to send my customers all files again. The notification that the payment has been received is enough. Some customers have automated mail processing systems within their ERP. This can lead to an unwanted “re-entry” of my invoices in their systems (ok, would be good for me, bad for them :wink: ).

Hi,

There’s an option on Settings > Email Settings to determine if the PDF is attached but I believe it applies to all emails.

I found a solution by myself: slighlty adjust the Dockerfile.

Within the container:

/var/www/html/app/Mail/Engine/PaymentEmailEngine.php

handles the payment mails. To disable the attachment of invoices and other documents you’ll have to add additional code below of:

# Setup InvoiceNinja
COPY --from=prepare-app --chown=www-data:www-data /var/www/html /var/www/html
COPY --from=prepare-app --chown=www-data:www-data /tmp/public /tmp/public

Extra code:

# Patch: don't send attachments on payment mails
RUN sed -i '/pdf_email_attachment.*FEATURE_PDF_ATTACHMENT)) {/c\        if (false) { /* IN: payment-mail attachments disabled */' \
    /var/www/html/app/Mail/Engine/PaymentEmailEngine.php

To ensure that everthing works, run:

docker compose down
docker compose build --no-cache
docker compose up -d

Hope this helps other users :slightly_smiling_face:

1 Like

Glad to hear it, thanks for sharing the solution!