This is a ASP.NET Core Service that handles basic email authentication and sending custom email messages via Azure Communications Service.
To get started, clone this repo and run
docker compose up
To create mock databases & run migrations, and run:
dotnet run --project EmailService/EmailService.csproj
To start the service. You can access the swagger page at localhost/swagger/index.html
.
- Entity Framework Core
- Azure SQL Database & Server
- Azure Communication Service
- SmtpClient
- NSubstitute
- XUnit
- TestContainers - Dockerized DB + EF
- Docker - SQL
- OpenTelemetry (reporting to Azure)
- Dependency Injection
- SwaggerUI & OpenAPI
Email: string, required
: Email to send the authentication code
Sends a GUID as an authentication code to the specified email. The code is stored on server-side, and is used in authenticating users, creating session cookies, etc.
One can only send one authentication requests per day to the same email.
This endpoint is rate-limited.
Email: string, required
: Email to create authentication cookie with
AuthenticationCode: GUID, required
: Authentication code received by the user
Creates a session cookie based on the authentication code & email received, and logs user in.
Will only create one if the authentication code matches the one in the database.
None
Removes the session cookie and logs user out.
Recipient: required string
: Recipient of the email message.
Subject: string
: Subject of the email
Body: string
: Body of the email
Crafts an email message and queues the message via SmtpClient
.
For now, will only accept email messages that are towards oneself (will check your cookie). User must be authenticated.
Recipient: string, deprecated
: Ignored in this endpoint
Subject: string
: Subject of the email
Body: string
: Body of the email
Crafts an email message pointed towards Shin, and queues the message.
Allows CORS requests to accept requests from frontend.