Can I use SMTP with Vercel?

While the Vercel platform does not block outgoing SMTP connections except for port 25, it is recommended to use a third-party service to send email.

Sending Email

To send emails from Vercel without restrictions, we recommend the use of a third-party mail services:

By using one of the services listed above, you will also benefit from analytics, scheduling, and many other features exclusively available from a specialized service. In addition, they support REST APIs, and there are official/third-party API client packages available so that you can send emails over HTTP protocol rather than SMTP. This is generally the better way of implementing email functionality in your app as they scale and perform well.

Using SMTP

If you wish to use SMTP rather than a third-party mail service, it is essential that you await the sending of the message, this can take a few seconds depending on the provider and library used.

The reason for this is because as soon as the response is sent by the Serverless Function to the client, any synchronous work being completed in the background will be paused and may be continued when the function is called once again.

Further Information

You can read more about using Serverless Functions to send email to your users in the solution documentation.

Couldn't find the guide you need?