0

This is my first Post at serverfault. I hope someone can help me.

My setup looks like this:

I have a RabbitMQ where emails are queued. I've written a small Python tool that retrieves one email at a time from the queue and sends it to the local Postfix. It then waits for acknowledgment (ACK) before fetching a new email from the queue.

However, my challenge is to ensure that the email has been successfully processed by Postfix before sending an ACK to RabbitMQ to confirm the successful processing.

My idea is to trigger the tool (that acks the mail from the rabbitmq. ) once the email has been successfully sent from Postfix.

I'm currently stuck on how to make Postfix trigger my script after the E-Mail has been successfully sent. is there a way to make this work?

6
  • 1
    "my challenge is to ensure that the email has been successfully processed by Postfix and sent to the relay host" - Why use the intermediate Postfix at all and not have your application submit the message directly to that relay host if that is the desired result? Commented Oct 24, 2023 at 14:18
  • Thanks for the fast response! That was my first idear as well. However, Postfix proves to be a more secure and robust option when compared to a self-built SMTP server. This makes me to go with Postfix. Commented Oct 24, 2023 at 14:39
  • Then why RabbitMQ and don't make use of Postfix's own robust and reliable queue manager? Just post directly to its submission service without anything in between. Commented Oct 24, 2023 at 14:41
  • This system runs in a Kubernetes cluster, and that's why I require RabbitMQ. I have many flexible Postfix hosts, all of which receive emails from the same RabbitMQ. However, there's an issue when these hosts are reduced in number, causing emails to be lost if they are stuck in the Postfix local queue. This is why I need to make sure that emails are processed by Postfix successfully before sending an acknowledgment to RabbitMQ. Commented Oct 24, 2023 at 14:55
  • Well, then you have to monitor logs. Postfix doesn't have any built-in capability to report its actions other than to log it. That said, I am still not convinced that RabbitMQ is needed. Make Postfix queue non-volatile. The whole RabbitMQ idea is essentially to have email-like queue when there is no need for SMTP. You seem to have the need of SMTP so you use Postfix, which has a email queue and so you don't need the RabbitMQ. Yes, and I understand that you might think you have "converged things with RabbitMQ" but you are not. "Don't do this" is a valid answer. Commented Oct 24, 2023 at 14:58

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.