From c13a0f8d51fd1cd3e176dc7ea8f01fc7d4352acd Mon Sep 17 00:00:00 2001 From: lovasoa Date: Fri, 3 Jan 2025 23:55:36 +0100 Subject: [PATCH] email readme --- examples/sending emails/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/sending emails/README.md b/examples/sending emails/README.md index 8ff1dae3..e45b1b6e 100644 --- a/examples/sending emails/README.md +++ b/examples/sending emails/README.md @@ -25,16 +25,18 @@ Email services solve these problems by providing reliable APIs for sending email Here's a complete example using Mailgun's API to send emails through SQLPage: +### [`email.sql`](./email.sql) ```sql -- Configure the email request set email_request = json_object( 'url', 'https://api.mailgun.net/v3/' || sqlpage.environment_variable('MAILGUN_DOMAIN') || '/messages', 'method', 'POST', 'headers', json_object( + 'Content-Type', 'application/x-www-form-urlencoded', 'Authorization', 'Basic ' || encode(('api:' || sqlpage.environment_variable('MAILGUN_API_KEY'))::bytea, 'base64') ), 'body', - 'from=Sender Name ' + 'from=Your Name ' || '&to=' || $to_email || '&subject=' || $subject || '&text=' || $message_text