Skip to content

Example demonstrating how to use Durable Functions to send a confirmation email via SMTP

License

Notifications You must be signed in to change notification settings

introtocomputerscience/durable-functions-smtp-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Durable Functions SMTP Example

This example demonstrates how to use Durable Functions to send a confirmation email via SMTP(Example using gmail). The user has 15 minutes to confirm or deny the email by clicking a link. The link in the email contains a code that is validated server side to ensure it was a valid click. This could easily be implemented to integrate within registration for a website or application.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

  • Visual Studio 2017
  • Azure Functions and Web Jobs Tools Visual Studio Extension
  • Azure Storage Emulator
  • CURL or PostMan

Installing

Clone the repository to your local machine

Open in Visual Studio and add a local.settings.json file with the following contents:

{
  "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "UseDevelopmentStorage=true",
    "AzureWebJobsDashboard": "UseDevelopmentStorage=true",
    "FUNCTIONS_WORKER_RUNTIME": "dotnet",
    "DisplayName": "John Smith",
    "SMTPUsername": "yoursmtpuser@gmail.com",
    "SMTPPassword": "smtppassword",
    "SMTPHost": "smtp.gmail.com",
    "SMTPPort": "587"
  }
}

Note: If you are using Gmail then you need to do the following:

  • Sign into Gmail.
  • Go to the “Less secure apps” section in My Account.
  • Next to “Allow less secure apps: OFF,” select the toggle switch to turn on. (Note to G Suite users: This setting is hidden if your administrator has locked less secure app account access.)

Run the project in Visual Studio and make a request using your favorite tool like PostMan or CURL

POST http://localhost:7071/api/orchestrators/RequestApproval
{
	"Requestor": {
		"FirstName": "CJ",
		"LastName": "van der Smissen"
	},
	"Email": "test@test.com"
}

Deployment

  • Right click the project and select Publish
  • Follow the prompts to publish in Azure
  • Login to Azure Portal and update the application settings to the appropriate values you previously used in local.settings.json

Built With

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the GPL License - see the LICENSE.md file for details

Acknowledgments

About

Example demonstrating how to use Durable Functions to send a confirmation email via SMTP

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages