4

Its there a way to use an API like(sendgrid, mailgun) to send Email through Firebase cloud functions or it is considered as an Outbound connection?

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
Tido
  • 73
  • 1
  • 5
  • Your question doesn't really make sense. Lots of people use mail services with Cloud Functions, so it is definitely possible. They all must make outgoing connections, which means you must upgrade to a payment plan. – Doug Stevenson Nov 30 '18 at 19:53

1 Answers1

8

Assuming you're asking because you're on the free Firebase plan. As explained on the Firebase pricing page:

The Spark plan allows outbound network requests only to Google-owned services.

Luckily, there is a Google-owned service that allows mail sending; Gmail! There is a quick-start sample available or a related StackOverflow answer, but the method has the following limits:

You may see this message if you send an email to a total of more than 500 recipients in a single email and or more than 500 emails in a day sent.

There is no Google-owned mail API that allows unlimited emails. As the quick start sample linked above states:

If you are planning on sending a large number of emails you should use a professional email sending platform such as Sendgrid, Mailjet or Mailgun.

Jake Lee
  • 7,549
  • 8
  • 45
  • 86
  • 1
    Please have a look at this official Cloud Functions sample: https://github.com/firebase/functions-samples/tree/Node-8/email-confirmation. If you are under the limits you **can** sends email through SMTP **using a Gmail account**. Limits are "a total of more than 500 recipients in a single email and/or more than 500 emails in a day sent", see https://support.google.com/mail/answer/22839 – Renaud Tarnec Dec 01 '18 at 10:15
  • You're quite right, my apologies. Want to leave an answer, or should one of us edit it into my accepted one? – Jake Lee Dec 01 '18 at 10:19
  • 1
    @RenaudTarnec You got it bud. Thanks again. – Jake Lee Dec 01 '18 at 10:39