Skip to content

abhirockzz/fn-email-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Function to send emails using Oracle Cloud Infrastructure Email Delivery

Function to send emails with Oracle Cloud Infrastructure Email Delivery. It just uses the plain old SMTP package in Go

Pre-requisites

Configure OCI Email Delivery

Clone this repo

Switch to correct context

  • fn use context <your context name>
  • Check using fn ls apps

Create app

fn create app --annotation oracle.com/oci/subnetIds=<SUBNETS> --config OCI_EMAIL_DELIVERY_USER_OCID=<OCI_EMAIL_DELIVERY_USER_OCID> --config OCI_EMAIL_DELIVERY_USER_PASSWORD=<OCI_EMAIL_DELIVERY_USER_PASSWORD> --config REGION=<REGION> --config OCI_EMAIL_DELIVERY_SMTP_SERVER=<OCI_EMAIL_DELIVERY_SMTP_SERVER> --config OCI_EMAIL_DELIVERY_APPROVED_SENDER=<OCI_EMAIL_DELIVERY_APPROVED_SENDER> fn-email-app

e.g.

fn create app --annotation oracle.com/oci/subnetIds='["ocid1.subnet.oc1.phx.aaaaaaaaghmsma7mpqhqdhbgnby25u2zo4wqlrrcskvu7jg56dryxt3hgvkz"]' --config OCI_EMAIL_DELIVERY_USER_OCID=ocid1.user.oc1..aaaaaaaa4seqx6jeyma46ldy4cbuv42q4l26scz5p4rkz3rauuoioo42qwmq@ocid1.tenancy.oc1..aaaaaaaaydrjm77otncda2xn7qtv7l3hqnd3zxn2u6siwdhniibwfv4wwhta.3n.com --config OCI_EMAIL_DELIVERY_USER_PASSWORD='s3cr3t:-)' --config OCI_EMAIL_DELIVERY_SMTP_SERVER=smtp.us-phoenix-1.oraclecloud.com --config OCI_EMAIL_DELIVERY_APPROVED_SENDER=test@test.com fn-email-app

Check

fn inspect app fn-email-app

Moving on...

Deploy the app...

cd fn-email-app and fn -v deploy --app fn-email-app

Test it out

change the email contents as per your requirements (don't forget to provide a valid email address)

echo -n '{"To": "test@gmail.com", "Subject": "Hello from Fn", "Body": "Have fun with Fn at fnproject.io"}' | fn invoke fn-email-app sendemail

If all goes well, you should see the email (don't forget to check your spam folder) and a response from the function - Sent email successfully!

About

Function to send emails using Oracle Cloud Infrastructure Email Delivery

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages