Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send an email inside a Edge function #45

Open
nuno84 opened this issue Jun 9, 2023 · 4 comments
Open

Send an email inside a Edge function #45

nuno84 opened this issue Jun 9, 2023 · 4 comments

Comments

@nuno84
Copy link

nuno84 commented Jun 9, 2023

Hi,
I can send an email using SMTP in Typescript.

import { SMTPClient } from "https://deno.land/x/denomailer/mod.ts";
....
  const smtp = new SMTPClient({
    connection: {
      hostname: Deno.env.get('_SMTP_HOSTNAME')!,
      port: Number(Deno.env.get('_SMTP_PORT')!),
      tls: true,
      auth: {
        username: Deno.env.get('_SMTP_USERNAME')!,
        password: Deno.env.get('_SMTP_PASSWORD')!,
      },
    },
  });
...
await smtp.send({ ....})

However I would prefer to use Dart on the Edge functions.
I tried to use the mailer library but it doesn't work. issue
What is the best way to achieve this?
I can't seem to find a solution in the web, which is weird because I thought it would be a usual feature.
Am I overlooking something?
Thank you for any tips

@MichealReed
Copy link

Use something like mailgun or another actual SMTP API. Using cloud function ips for email sending is a good way to get flagged as spam. Probably many other reasons not to do this with a serverless function too.

@nuno84
Copy link
Author

nuno84 commented Jun 20, 2023

Hi Machael,
But the question is why is it possible in Typescript but there is no alternative in Dart?
After all, Dart is converted to JS as well. I can't figure out a reason for it. You are saying that it is bad practice to use in Typescript also, is that it?
Thank you for your time.

@MichealReed
Copy link

Yes, bad practice in both. If supabase hasn't blocked, they probably will at some point. As far as being possible in JS vs Dart, it's all about the libraries. JS/Typescript typically has more than dart, but dart is catching up.

@henry2man
Copy link

Use something like mailgun or another actual SMTP API. Using cloud function ips for email sending is a good way to get flagged as spam. Probably many other reasons not to do this with a serverless function too.

@nuno84 Maybe we should accept this as the proper solution...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants