FriendsOfShopware / FroshPlatformMailArchive

This plugin allows you to archive your mails.
MIT License
16 stars 13 forks source link

All email are classified as "pending", despite being sent out successful #85

Open artdevil-de opened 1 month ago

artdevil-de commented 1 month ago

Question

The latest version of MailArchive introducted the Status for the mails. On my system all emails (100%) are categoriesed as "pending" despite being successfully send out.

My Mailer configuration ist "lokal email agent" and "asyncron".

I can confirm that the emails are successfully sent, as I recieve a copy of them via bcc.

Questions, what determins that an email is categories as "pending" or "successfull"?

tinect commented 1 month ago

hi @artdevil-de

state is not new, but now shown in listing and filterable.

it looks like the specific symfony event is not called on your end or are the mails old? Do new mails also have pending state?

https://github.com/FriendsOfShopware/FroshPlatformMailArchive/blob/main/src/Subscriber/MailTransportSubscriber.php

artdevil-de commented 1 month ago

Hi @tinect, thanks for the quick reply.

I am currently on the latest version of the plugin, 3.1.0

As far as I am aware, all emails that are sent from our system are showing up in the Archive. I have just checked the Archive, the state is filled with "pending" going back to the 22nd of December 2023. And yes to the latest email, just 2 minutes ago, is showing "pending" as state as well.

As I wrote, I am using "local email agent" with "asynchronous mail dispatch" and it is working fine for the actual email, as they get delivered.

Going a bit deeper into our system, we have postfix running as mail server, that forwards the emails to a smarthost, which does the actual sending of the email to the world wide web. both servers acknowledge the reciept of the emails, I have zero errors in the mail log.

tinect commented 1 month ago

Hi @artdevil-de

Thank you for your response. I had a moment to review the situation.

I noticed that the events used to track the sent state are not triggered when mails aren't sent via the queue. Since there's no specific event dedicated to tracking such emails, it becomes challenging to manage.

Additionally, shopware does not announce the queue to the SendmailTransport, while it will currently not work at all when activating the queue for mails. I have created an issue for this: https://github.com/shopware/shopware/issues/4685

See, you brought two problems to light xD

You cannot use SMTP directly (with active queue), can you?

artdevil-de commented 1 month ago

Hi @tinect , thank you for looking into this issue, and debugging the cause of the issue.

I would prefer not to mess with the mail settings, as several other sites on the same server, and with all the SPF and DMARC settings, I rather not change the current flow of mails.

For me this issue is not critical, I was just wondering why the plugin showed the wrong state for the emails. I recieve bcc of all mails, so I can archive them properly, which is done at the smarthost mentioned earlier.

There is a "MailTask" queue, can't you interrogate that? If it gets too compley, suggestion, hide this feature for asyncron sending, to not confuse people, until you figured out a way to catch these mails as well.

Thanks for your support

tinect commented 1 month ago

There is a "MailTask" queue, can't you interrogate that?

This task is about cleanup mails, therefore it is another topic. And managing it within a task does not have any more information about the state.

I have created a PR at shopware to fix that bug not using the queue - if defined.

This will not change the state of any old once. Currently, I don‘t want to invest any time to catch also mails that are not sent by queue, while you should not make your users have storefront loading when the mail is being sent.

I am thinking of changing the initial state from pending to unknown or adding an info.

tinect commented 1 week ago

FYI, PR has been merged: https://github.com/shopware/shopware/commit/0fc68fcd20a9d8d73332ae2e0f59f9f20a7b6deb