### Deploying the Function with doctl (Bash) Source: https://github.com/digitalocean/sample-functions-python-sendgrid-email/blob/main/README.md Deploys the sample function to your DigitalOcean App Platform using the `doctl` CLI. The `--remote-build` flag ensures the build happens in the cloud environment. ```bash doctl serverless deploy sample-functions-python-sendgrid-email --remote-build ``` -------------------------------- ### Cloning the Sample Function Repository (Bash) Source: https://github.com/digitalocean/sample-functions-python-sendgrid-email/blob/main/README.md Clones the sample Python Sendgrid email function repository from GitHub to your local machine. This is the first step before deploying the function. ```bash git clone git@github.com:digitalocean/sample-functions-python-sendgrid-email.git ``` -------------------------------- ### Invoking the Function with doctl (Bash) Source: https://github.com/digitalocean/sample-functions-python-sendgrid-email/blob/main/README.md Invokes the deployed serverless function using the `doctl` CLI, passing email parameters (`from`, `to`, `subject`, `content`) as payload. ```bash doctl serverless functions invoke sample/emails -p from:user@do.com to:user@gmail.com subject:Sammy content:Good Morning from Sammy. ``` -------------------------------- ### Specify SendGrid Dependency (Python) Source: https://github.com/digitalocean/sample-functions-python-sendgrid-email/blob/main/packages/sample/emails/requirements.txt This line specifies the required 'sendgrid' package and its exact version (6.4.6) for the project. This is typically found in a 'requirements.txt' file used by package managers like pip to ensure reproducible builds. ```Python sendgrid==6.4.6 ``` -------------------------------- ### Invoking the Function with curl (Bash) Source: https://github.com/digitalocean/sample-functions-python-sendgrid-email/blob/main/README.md Invokes the deployed serverless function via an HTTP PUT request using `curl`. The email parameters are passed in the request body as JSON. ```bash curl -X PUT -H 'Content-Type: application/json' {your-DO-app-url} -d '{"from":"user@do.com", "to":"user@gmail.com", "subject": "Sammy", "content":"Good Morning from Sammy!"}' ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.