mail
mail copied to clipboard
Email is sent but stuck in Outbox too.
Steps to reproduce
- Add a new message
- Send email
- Mail is sent
- Mail also stuck in Outbox
Expected behavior
Mail is sent and not stuck in Outbox
Actual behavior
Mail is sent and stuck in Outbox
Mail app version
3.6.0
Mailserver or service
Modoboa
Operating system
Ubuntu 22.04
PHP engine version
PHP 8.1
Web server
Nginx
Database
PostgreSQL
Additional info
browser console errors:
AvatarService.js:36 GET https://{host}/index.php/apps/mail/api/avatars/url/MAILER-DAEMON%40{domain} 404 (Not Found) OutboxService.js:72 POST https://{host}/index.php/apps/mail/api/outbox/37 500 (Internal Server Error) actions.js:134 [ERROR] mail: Failed to send message 37 from outbox {app: 'mail', uid: '{user}', level: 2, error: a} actions.js:182 [ERROR] mail: Could not delay-send message 37 {app: 'mail', uid: '{user}', level: 2, message: {…}} vuex.esm.js:542 Uncaught (in promise) a {message: 'Request failed with status code 500', name: 'AxiosError', code: 'ERR_BAD_RESPONSE', config: {…}, request: XMLHttpRequest, …}
NextCloud version 28.0.4.1
If you need any more information or logs, please tell me where to get such information too. I'm new to this.
This is the information from Admin Logging page.
[mail] Error: Could not send message: Error when communicating with the server. POST /index.php/apps/mail/api/outbox/38 from {ip} by {user} at May 2, 2024, 10:49:07 AM
{"reqId":"3lqDbXk4dO7BvfSHFpAa","level":3,"time":"2024-05-02T03:49:07+00:00","remoteAddr":"{ip}","user":"{user}","app":"mail","method":"POST","url":"/index.php/apps/mail/api/outbox/38","message":"Could not send message: Error when communicating with the server.","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36","version":"28.0.4.1","exception":{"Exception":"OCA\Mail\Exception\ServiceException","Message":"Could not send message: Error when communicating with the server.","Code":2,"Trace":[{"file":"/var/www/nextcloud/apps/mail/lib/Service/MailTransmission.php","line":343,"function":"sendMessage","class":"OCA\Mail\Service\MailTransmission","type":"->"},{"file":"/var/www/nextcloud/apps/mail/lib/Service/OutboxService.php","line":142,"function":"sendLocalMessage","class":"OCA\Mail\Service\MailTransmission","type":"->"},{"file":"/var/www/nextcloud/apps/mail/lib/Controller/OutboxController.php","line":247,"function":"sendMessage","class":"OCA\Mail\Service\OutboxService","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":230,"function":"send","class":"OCA\Mail\Controller\OutboxController","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":137,"function":"executeController","class":"OC\AppFramework\Http\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/App.php","line":184,"function":"dispatch","class":"OC\AppFramework\Http\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\AppFramework\App","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":1069,"function":"match","class":"OC\Route\Router","type":"->"},{"file":"/var/www/nextcloud/index.php","line":39,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/nextcloud/apps/mail/lib/Service/MailTransmission.php","Line":273,"Previous":{"Exception":"Horde_Mime_Exception","Message":"Error when communicating with the server.","Code":2,"Trace":[{"file":"/var/www/nextcloud/apps/mail/vendor/bytestream/horde-mime/lib/Horde/Mime/Mail.php","line":479,"function":"send","class":"Horde_Mime_Part","type":"->"},{"file":"/var/www/nextcloud/apps/mail/lib/Service/MailTransmission.php","line":271,"function":"send","class":"Horde_Mime_Mail","type":"->"},{"file":"/var/www/nextcloud/apps/mail/lib/Service/MailTransmission.php","line":343,"function":"sendMessage","class":"OCA\Mail\Service\MailTransmission","type":"->"},{"file":"/var/www/nextcloud/apps/mail/lib/Service/OutboxService.php","line":142,"function":"sendLocalMessage","class":"OCA\Mail\Service\MailTransmission","type":"->"},{"file":"/var/www/nextcloud/apps/mail/lib/Controller/OutboxController.php","line":247,"function":"sendMessage","class":"OCA\Mail\Service\OutboxService","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":230,"function":"send","class":"OCA\Mail\Controller\OutboxController","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":137,"function":"executeController","class":"OC\AppFramework\Http\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/App.php","line":184,"function":"dispatch","class":"OC\AppFramework\Http\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\AppFramework\App","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":1069,"function":"match","class":"OC\Route\Router","type":"->"},{"file":"/var/www/nextcloud/index.php","line":39,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/nextcloud/apps/mail/vendor/bytestream/horde-mime/lib/Horde/Mime/Part.php","Line":1642,"Previous":{"Exception":"Horde_Mail_Exception","Message":"Error when communicating with the server.","Code":2,"Trace":[{"file":"/var/www/nextcloud/apps/mail/vendor/bytestream/horde-mime/lib/Horde/Mime/Part.php","line":1620,"function":"send","class":"Horde_Mail_Transport_Smtphorde","type":"->"},{"file":"/var/www/nextcloud/apps/mail/vendor/bytestream/horde-mime/lib/Horde/Mime/Mail.php","line":479,"function":"send","class":"Horde_Mime_Part","type":"->"},{"file":"/var/www/nextcloud/apps/mail/lib/Service/MailTransmission.php","line":271,"function":"send","class":"Horde_Mime_Mail","type":"->"},{"file":"/var/www/nextcloud/apps/mail/lib/Service/MailTransmission.php","line":343,"function":"sendMessage","class":"OCA\Mail\Service\MailTransmission","type":"->"},{"file":"/var/www/nextcloud/apps/mail/lib/Service/OutboxService.php","line":142,"function":"sendLocalMessage","class":"OCA\Mail\Service\MailTransmission","type":"->"},{"file":"/var/www/nextcloud/apps/mail/lib/Controller/OutboxController.php","line":247,"function":"sendMessage","class":"OCA\Mail\Service\OutboxService","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":230,"function":"send","class":"OCA\Mail\Controller\OutboxController","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":137,"function":"executeController","class":"OC\AppFramework\Http\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/App.php","line":184,"function":"dispatch","class":"OC\AppFramework\Http\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\AppFramework\App","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":1069,"function":"match","class":"OC\Route\Router","type":"->"},{"file":"/var/www/nextcloud/index.php","line":39,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/nextcloud/apps/mail/vendor/bytestream/horde-mail/lib/Horde/Mail/Transport/Smtphorde.php","Line":145,"Previous":{"Exception":"Horde_Smtp_Exception","Message":"Error when communicating with the server.","Code":2,"Trace":[{"file":"/var/www/nextcloud/apps/mail/vendor/nextcloud/horde-smtp/lib/Horde/Smtp.php","line":1046,"function":"read","class":"Horde_Smtp_Connection","type":"->"},{"file":"/var/www/nextcloud/apps/mail/vendor/nextcloud/horde-smtp/lib/Horde/Smtp.php","line":1112,"function":"_getResponse","class":"Horde_Smtp","type":"->"},{"file":"/var/www/nextcloud/apps/mail/vendor/nextcloud/horde-smtp/lib/Horde/Smtp.php","line":757,"function":"_processData","class":"Horde_Smtp","type":"->"},{"file":"/var/www/nextcloud/apps/mail/vendor/bytestream/horde-mail/lib/Horde/Mail/Transport/Smtphorde.php","line":143,"function":"send","class":"Horde_Smtp","type":"->"},{"file":"/var/www/nextcloud/apps/mail/vendor/bytestream/horde-mime/lib/Horde/Mime/Part.php","line":1620,"function":"send","class":"Horde_Mail_Transport_Smtphorde","type":"->"},{"file":"/var/www/nextcloud/apps/mail/vendor/bytestream/horde-mime/lib/Horde/Mime/Mail.php","line":479,"function":"send","class":"Horde_Mime_Part","type":"->"},{"file":"/var/www/nextcloud/apps/mail/lib/Service/MailTransmission.php","line":271,"function":"send","class":"Horde_Mime_Mail","type":"->"},{"file":"/var/www/nextcloud/apps/mail/lib/Service/MailTransmission.php","line":343,"function":"sendMessage","class":"OCA\Mail\Service\MailTransmission","type":"->"},{"file":"/var/www/nextcloud/apps/mail/lib/Service/OutboxService.php","line":142,"function":"sendLocalMessage","class":"OCA\Mail\Service\MailTransmission","type":"->"},{"file":"/var/www/nextcloud/apps/mail/lib/Controller/OutboxController.php","line":247,"function":"sendMessage","class":"OCA\Mail\Service\OutboxService","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":230,"function":"send","class":"OCA\Mail\Controller\OutboxController","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":137,"function":"executeController","class":"OC\AppFramework\Http\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/App.php","line":184,"function":"dispatch","class":"OC\AppFramework\Http\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\AppFramework\App","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":1069,"function":"match","class":"OC\Route\Router","type":"->"},{"file":"/var/www/nextcloud/index.php","line":39,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/nextcloud/apps/mail/vendor/nextcloud/horde-smtp/lib/Horde/Smtp/Connection.php","Line":130}}},"message":"Could not send message: Error when communicating with the server.","exception":[],"CustomMessage":"Could not send message: Error when communicating with the server."},"id":"66330d3d4b9d9"}
Duplicate of https://github.com/nextcloud/mail/issues/8435.
A fix is coming with v3.7.
Fixed in 3.7
I am having the same problem, the email is sent but it's stuck in the outbox.
I'm running NextCloud version 29.0.3 - and Mail app version 3.7.2
Errors in console:
Errors in admin log:
@ChristophWurst @miaulalala
Had the same issue and worked out that the outbox is the table oc_mail_local_messages. Check the message and delete it. For me there was only one message so I emptied the table. Warning will stop in the log after this action.
Had the same issue and worked out that the outbox is the table oc_mail_local_messages. Check the message and delete it. For me there was only one message so I emptied the table. Warning will stop in the log after this action.
Yea I deleted the message from the outbox too. Now I'm giving SnappyMail a try, not as pretty but actually working.
I am having the same problem, the email is sent but it's stuck in the outbox.
I'm running NextCloud version 29.0.3 - and Mail app version 3.7.2
Errors in console:
Errors in admin log:
@ChristophWurst @miaulalala
We have 3 states for the outbox when a send error happens - the mail was sent but couldn't be copied to the sent mailbox. This error will be handled by the logic and the copy operation will be tried again. - the send was unsuccessful with a state than can be retried (ex: the SMTP server couldn't be reached). We will retry sending the message again. - the send operation might or might not have failed - the error you have. As we have no way to determine if the message was sent or not, we do nothing with the message. We don't want to assume it was sent (a double send is not a desired outcome) but we also don't want to delete the message in case the mail was NOT sent. So it's up to the account owner to determine what happens next.
Thank you @miaulalala for the explanation. It makes sense.
It also begs the followup question, what makes the mail app (horde) consider the send state "unclear" in my case, although all other mail clients are okay with it? I've been using this particular mail server (CPanel) for years with a myriad of email clients such as Apple Mail, Thunderbird, Roundcube, Gmail, and lately SnappyMail. They all produce no errors when sending and messages get moved from the outbox to sent without fail.
Maybe you've been testing with "fancier" enterprise mail servers, which makes total sense. Perhaps you could consider revisiting this at a later stage to make the app more forgiving for smaller setups?
Thanks a lot!
Some of the errors entirely depends on your mail server configuration - in my setup for example I wasn't able to observe the copy error, but other Devs with a dovecot setup for example had an issue because of the number of connections that were attempted in a certain amount of time. Since we still want to be robust in this, we decided to add the copy retry.
As for the indeterminate errors, the SMTP connection read and write methods in Horde might throw a \Horde_Smtp_Exception::DISCONNECT
error, a \Horde_Smtp_Exception::SERVER_READERROR
or a \Horde_Smtp_Exception::SERVER_WRITEERROR
at any time in the transmission flow. So it could happen at the end of a command sequence so the mail is sent, but there's no corresponding SMTP reply, or it could happen in the middle of a command sequence. I could also imagine an issue with Horde and how it deals with the SMTP replies, although that is just a hunch, not a definitive.
We have no way of knowing what happened, and as far as I know there is no part in the SMTP protocol that allows for a query to the state of the message.
There might possibly be a better way to do this, but I haven't found it (yet). Suffice to say we had issues with duplicate / multiple send operations on the same email before we split the error handling into multiple states. Unfortunately I can't make any promises about looking into this, as that would mean digging into the RFCs and unfortunately, my time is limited at the moment.
Does this answer your questions?
Thanks @miaulalala for taking the time to explain this. You're correct, my setup is utilizing Dovecot, as I have no access to its configuration I suppose it's time to consider other options for mail hosting.
Thank you for all the support and the brilliant work!