Design pattern sending emails different SMTP


So I'm trying to create a design for sending for example a sales invoice emails to my customer's.

So on the top I have a screen and in that screen (finance) there is button that a user can click on to send the invoice to the customer. So there is a salesinvoice_email module with a service to send the email with a input parameter salesinvoicekey.

In the middle there should be some modules that based on the hierarchy connected to the invoice generates the email body. The sales invoice could be connected for example department 1 or department 2. For each department it could be that a different layout and content in the email should be created. 

At the bottom there is a email_CS component that receives the body and the to addresses places them on a queue and based on the send date time sends the email. Because the departments can have different SMTP servers we where planning to use a extension and configure in the email_CS the SMTP server.

Any idea's on this?

Hi Freek,

I dont think you can change SMPT configuration at runtime, because it is one time activity for a server.

But you can send different desing/layout Email at department wise.



Hi Rahul,

That's why I want to use the SMTP extention from the forge to send the emails.

It's more about I don't want to create for each different department a different email module to generate the style and the content. But I also don't want to create one big module that contains all the styles so I'm a bit of what is better to do?