Use n8n as SMTP

Dear community, this is a longshot but hope I can get a hint.
I use an ecommerce platform that allows to setup my own SMTP for transactional emails. I wanted to setup n8n webhook to receive these SMTP calls from this ecomm platform service and then forward via an http request to MSGraph and this service will be the one actually sending the emails.

Any clue if the webhook can be setup to receive these SMTP validation and then calls so that I can accomplish this?

Thanks!
Andres

1 Like

Basically you want to use n8n as a bridge between you ecom platform and MSGraph which is your SMTP Provider. Is that right?

So you can send emails with the help of n8n.

If Yes, Keep reading.

Does your ecom platform having outgoing webhook functionality where you can put your n8n webhook endpoint?

If it does, It’s easy. All you need is Webhook Node and Email Node.

I have worked on this use case for one of my product.

What I did was, Inside the Code I wrote a function which sends data to n8n webhook endpoint and it sends an email, Also n8n helped me with saving the email data into Google Sheet (:star: BONUS)

This is my Workflow, I get data from Webhook then sends an email with n8n.

1 Like

Awesome @mcnaveen ! So, yes that is exactly what I need to do. I can setup a hook to notify certain events (on orders) and then go back and get the detail via http post. With this I can get a detailed order JSON, then build the html and send through MSGraph. However this is a lot of work.

The ecomm platform already has a ton of premade templates that handle the internal JSON arrays and via handlebars build the html that their internal SMTP sends out. They have 2 main configs. One is to use their SMTP (AWS) and you just authorize the sender email. The second which I was thinking to use is they also allow for you to add your own SMTP server for them to use with their templates.

So they ask for the host, port, username and password and send out some sort of validation to setup the SMTP on their side. I think what happens next is that their system send out the email (html, sender, to, cc etc) to this host. I tried using the webhook address as the host but the setup isn’t working (n8n isn’t receiving any data) and the other system gets a 400.

In a bit I will add some images here. Maybe this helps!

Alright, Just to clear up 1 point of confusement, Your e-commerce software can output to webhooks, right?
You dont mean to have n8n act an SMTP server (Receive SMTP Requests)

Because if the 2nd point is true, I dont believe you can do that without completely emulating/faking the SMTP protocol and to have the webhook act on the correct ports
In that case your other option would be to use the ReadImap node and have n8n act on incoming mail

Thanks @Damian_K . I actually wanted to emulate the SMTP. :grimacing:. If you see this almost impossible I will try to get the hooks and build templates on n8n or somewhere else. Will test the read IMAP but since these are transactional emails to different addresses I guess I would need to send all emails to one address and then send to the original destination via the MSGraph.

If you have any idea to accomplish the emulation of the SMTP by the n8n webhook it would be great.

Thanks
Andres

Hmm, You mentioned you can use your own SMTP server (This is quite the work-around but should work)
You could setup an SMTP Server with transport rules to redirect all out-going mail to your specified email address and then use the read IMAP node to act upon the incoming mails? Just a thought

But for your original intention i think @jan will have to shed some light on it but for as far as i know this wont be possible