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

Setup SMTP for Incidents #98

Open
PBhadoo opened this issue Aug 8, 2022 · 4 comments
Open

Setup SMTP for Incidents #98

PBhadoo opened this issue Aug 8, 2022 · 4 comments

Comments

@PBhadoo
Copy link

PBhadoo commented Aug 8, 2022

How can we setup SMTP for receiving email for incidents.

@iambenmitchell
Copy link

Last I checked, CF workers do not have the ability to make or receive SMTP requests. You can use an API like mailgun or your own to send and receive mail though.

Could be wrong, I haven't checked in a few months so maybe they added something recently?

@OnlyFor
Copy link

OnlyFor commented Mar 22, 2023

Maybe it's possible to use this to send email?

https://blog.cloudflare.com/sending-email-from-workers-with-mailchannels/

@yswtrue
Copy link

yswtrue commented Jul 27, 2023

Hope for smtp too

@gaborcsardi
Copy link

gaborcsardi commented Apr 14, 2024

FWIW, it is not too hard to add email notifications, it goes like this:
main...gaborcsardi:cf-workers-status-page:main
(Ignore the config and logo changes.)

You can only send emails from a domain that you control, and you need to add a TXT record to that domain's DNS, which looks like this:

_mailchannels TXT v=mc1 cfid=<myhost>.workers.dev

where <myhost> is your workers subdomain (it is listed on the right side of the "Workers & Pages" page.

You'd probably also want a secret or a config option for the sender's email.

Great project, btw!

EDIT: two possible gotchas. First, some mail servers like gmail.com require at least an SPF record, see the example at https://medium.com/@tristantrommer/how-to-send-free-transactional-emails-with-worker-mailchannels-via-cloudflare-workers-818b787b33f9

Second, that SPF record might interfere with an existing one, e.g. if you also set up email forwarding on cloudflare. Then you need both mail servers in the SPF record, e.g.

@ TXT "v=spf1 include:_spf.mx.cloudflare.net include:relay.mailchannels.net ~all"

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

5 participants