Skip to content

Latest commit

 

History

History

send_email_with_mailgun

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

📧 Sending Welcome Emails using Mailgun's Email API

A sample Deno Cloud Function for sending emails using the Mailgun API.

Example input:

{
    "name": "John Doe",
    "email": "[email protected]"
}

Example output:

email sent successfully.

📝 Environment Variables

List of environment variables used by this cloud function:

  • MAILGUN_API_KEY - API Key for Mailgun
  • MAILGUN_DOMAIN - Domain Name from Mailgun

🚀 Deployment

  1. Clone this repository, and enter this function folder:
$ git clone https://github.com/open-runtimes/examples.git && cd examples
$ cd deno/send_email_with_mailgun
  1. Enter this function folder and build the code:
docker run -e INTERNAL_RUNTIME_ENTRYPOINT=src/mod.ts --rm --interactive --tty --volume $PWD:/usr/code openruntimes/deno:v2-1.14 sh /usr/local/src/build.sh

As a result, a code.tar.gz file will be generated.

  1. Start the Open Runtime:
docker run -p 3000:3000 -e INTERNAL_RUNTIME_ENTRYPOINT=src/mod.ts -e INTERNAL_RUNTIME_KEY=secret-key --rm --interactive --tty --volume $PWD/code.tar.gz:/tmp/code.tar.gz:ro openruntimes/deno:v2-1.14 sh /usr/local/src/start.sh

Your function is now listening on port 3000, and you can execute it by sending POST request with appropriate authorization headers. To learn more about runtime, you can visit Deno runtime README.

📝 Notes

  • This function is designed for use with Appwrite Cloud Functions. You can learn more about it in Appwrite docs.
  • This example is compatible with Deno 1.13 and 1.14. Other versions may work but are not guarenteed to work as they haven't been tested.