Skip to content

An Azure server-less function written in JavaScript (Node) for handling contact forms on your personal website

License

Notifications You must be signed in to change notification settings

Bread-John/contact-me

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

contact-me

An Azure server-less function written in JavaScript (Node) for handling contact forms on your personal website


The function will do:

  1. Accept POST requests with user input from the front-end form
  2. Validate the user input against few predefined rules (will be covered in details below)
  3. Sanitise the user input so it does not contain any special character that may lead to injections
  4. Interact with Microsoft Graph REST API to forward the sender contact info and message to you as an email
  5. Send a response back to the front-end indicating the result of this process (success or fail)

The function will accept:

HTML Input name HTML Input type Input criteria Max input length Mandatory field
name text Any alphabetic character, and whitespace 40 characters Yes
email email Any valid email address Not applicable Yes
subject text No restrictions 50 characters Yes
msg textarea No restrictions 800 characters Yes

The function will need:

  • An Azure account with active subscription (to deploy this function)
  • An active work or school Microsoft account with global admin access to Azure Active Directory (to set up Graph API access key)
  • Register this function as a new application and acquire the client secret within AAD
  • Provide your Client ID, the acquired Client secret, the Tenant ID of your organisation, to your function app as environment variables via Azure Portal
  • Provide the sender (this function) and recipient (yourself) email addresses, also as environment variables, note the sender email has to be within your organisation, but the recipient email can be any service (personal Outlook, Gmail, Yahoo etc.)
  • These environment variables should be named as: CLIENT_ID, CLIENT_SECRET, TENANT_ID, SENDER_EMAIL_ADDR and RECIPIENT_EMAIL_ADDR respectively

Additional resources

License

Copyright © 2022 Bread-John. All Rights Reserved. Licensed under GNU General Public License v3.0 (see "License")

About

An Azure server-less function written in JavaScript (Node) for handling contact forms on your personal website

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published