Error sending emails with attachments when using custom upload_dir #4199

Open
opened 2026-02-20 16:14:48 -05:00 by deekerman · 1 comment
Owner

Originally created by @dgomezleon on GitHub (Jan 21, 2020).

Issue

When setting a different value upload_dir parameter in config.php (e.g. 1234_upload), emails are not able to send attachments. The files are properly uploaded to the server into 1234_upload path, but you obtain the following error after sending an email:

[FATAL] SugarPHPMailer encountered an error: Could not access file: upload/

changing the upload path in modules/Emails/Email.php fixes the issue.

Expected Behavior

I suppose that changing the upload_dir parameter in config.php file should be enough to make it work.

Actual Behavior

Obtaining:

[FATAL] SugarPHPMailer encountered an error: Could not access file: upload/

Possible Fix

Changing the upload path in modules/Emails/Email.php to use $upload_dir variable.

Steps to Reproduce

  1. Install SuiteCRM (I'm using a Bitnami installer)
  2. Set SMTP (using GMAIL account)
  3. Compose an email with an attachment.
  4. Check suitecrm.log

Context

As Bitnami Engineer, I would like to understand if we should change the installer logic or it is a bug.

Your Environment

  • SuiteCRM Version used: 7.11.10
  • Browser name and version: Version 79.0.3945.88 (Official Build) (64-bit)
  • Environment name and version (e.g. MySQL, PHP 7): MySQL 5.7.28, PHP 7.3.13, Apache 2.4.41
  • Operating System and version (e.g Ubuntu 16.04): Debian 4.9.189-3+deb9u2
Originally created by @dgomezleon on GitHub (Jan 21, 2020). #### Issue When setting a different value `upload_dir` parameter in `config.php` (e.g. `1234_upload`), emails are not able to send attachments. The files are properly uploaded to the server into `1234_upload` path, but you obtain the following error after sending an email: ``` [FATAL] SugarPHPMailer encountered an error: Could not access file: upload/ ``` changing the upload path in ` modules/Emails/Email.php` fixes the issue. #### Expected Behavior I suppose that changing the `upload_dir` parameter in `config.php` file should be enough to make it work. #### Actual Behavior Obtaining: ``` [FATAL] SugarPHPMailer encountered an error: Could not access file: upload/ ``` #### Possible Fix Changing the upload path in ` modules/Emails/Email.php` to use `$upload_dir` variable. #### Steps to Reproduce 1. Install SuiteCRM (I'm using a Bitnami installer) 2. Set SMTP (using GMAIL account) 3. Compose an email with an attachment. 4. Check `suitecrm.log` #### Context As Bitnami Engineer, I would like to understand if we should change the installer logic or it is a bug. #### Your Environment * SuiteCRM Version used: 7.11.10 * Browser name and version: Version 79.0.3945.88 (Official Build) (64-bit) * Environment name and version (e.g. MySQL, PHP 7): MySQL 5.7.28, PHP 7.3.13, Apache 2.4.41 * Operating System and version (e.g Ubuntu 16.04): Debian 4.9.189-3+deb9u2
Author
Owner

@pgorod commented on GitHub (Feb 4, 2020):

I think this is the commit that puts this into hard-coded upload dir...

github.com/salesagility/SuiteCRM@ba347ae86f

@pgorod commented on GitHub (Feb 4, 2020): I think this is the commit that puts this into hard-coded `upload` dir... https://github.com/salesagility/SuiteCRM/commit/ba347ae86f211fb07c95a19dd7f375d94f494791
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/SuiteCRM-SuiteCRM#4199
No description provided.