Send email in digital ocean

System Information
  • v4:
  • Ubuntu:
  • postgres:
  • ****:
  • ****:
  • ****:

Can anyone explain me how i can send email from strapi app deployed in digital ocean. When i try to send test email it show “Error: failed to send test email”. And when i try to send email from controller using the email provider i get an error with empty object.

What is your e-mail config?
Are you using nodemailer or other provider?

Have you checked all the plugins in Email - Strapi Developer Docs ?
My mail server is on DO and I have no problems sending e-mail from my local.dev through smtp…

I am using the default sendMail provided by strapi and trying to send mail to my gmail account.

For that have a look into nodemailer. As far as I understood the default plugin is very basic. Gmail is going to block those, you will need a working smtp server (could be your gmail).

Here is my current config. All variables should be in you .env file.

...
  email: {
    config: {
      provider: "nodemailer",
      providerOptions: {
        host: env("SMTP_HOST"),
        port: env("SMTP_PORT"),
        secure: false,
        auth: {
          user: env("SMTP_USERNAME"),
          pass: env("SMTP_PASSWORD"),
        },
      },
      settings: {
        defaultFrom: env("SMTP_SENDER"),
        defaultReplyTo: env("SMTP_SENDER"),
        testAddress: env("SMTP_SENDER"),
      },
    },
  },
...

Hope it helps

1 Like