Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not send email to <...> Unable to open path to message files #338

Open
megmed opened this issue Jun 10, 2024 · 0 comments
Open

Could not send email to <...> Unable to open path to message files #338

megmed opened this issue Jun 10, 2024 · 0 comments
Milestone

Comments

@megmed
Copy link

megmed commented Jun 10, 2024

Sometimes I get the following error in the message queue list of the notification center:
Fehler beim Senden der Nachricht. Prüfen Sie das System-Log für Details.

In the contao system log the following ist stated:
Could not send email to "[email protected]" for message ID 11: Unable to open path "test/contao4/var/notification_center/1312/Attachment.pdf"

I assume that this happens when the message queue tries to resend an email that could not be sent on the first attempt. I had a quick look in the source code and it seems that the message files are deleted no matter the email could be sent successfully or not.

foreach ($messages as $msg) {
/* @var $msg QueuedMessage */
$result = $msg->send();
if (!$result) {
$msg->error = 1;
} else {
$msg->dateSent = time();
}
// Remove the temporary message files
$this->removeMessageFiles($msg->id);

I guess $this->removeMessageFiles($msg->id); should only be called if the email was sent successfully?
Like this:

if (!$result) { 
         $msg->error = 1; 
     } else { 
         $msg->dateSent = time(); 
         // Remove the temporary message files 
         $this->removeMessageFiles($msg->id);
     } 

After that, adding the message to the queue again using the button from the queue list should also work, which is currently not the case for messages with file attachments.
image

@Toflar Toflar added this to the 1.7 milestone Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants