Lefty.Email 0.2.0

dotnet tool install --global Lefty.Email --version 0.2.0
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local Lefty.Email --version 0.2.0
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=Lefty.Email&version=0.2.0
                    
nuke :add-package Lefty.Email --version 0.2.0
                    

lemail

CI NuGet License: MIT

.NET tool to send emails through SMTP, Resend, or Azure Communication Services.

Installing

To install the tool as a repository tool, run the following command in the root of your repository:

> dotnet tool install --local Lefty.Email --create-manifest-if-needed

If you'd rather have the tool installed globally in your machine, run the following command:

> dotnet tool install --global Lefty.Email

Senders

When using smtp sender (default):

Env M/O Default Description
SMTP_HOST Mandatory none Hostname or IP address of SMTP server
SMTP_PORT Optional 587 Port number
SMTP_SSL Optional True Whether to use SSL
SMTP_USERNAME Optional null Username for authentication
SMTP_PASSWORD Required if username specified null Password

When using resend sender:

Env M/O Default Description
RESEND_APITOKEN Mandatory none API token, as obtained from dashboard
> set EMAIL_SENDER=resend
> set RESEND_APITOKEN=<api>

When using acs sender (Azure Communication Services):

Env M/O Default Description
ACS_CONNECTIONSTRING Either none Connection string, as obtained from Azure portal
ACS_ENDPOINT Either none Endpoint URL, when authenticating with Entra ID

Exactly one of ACS_CONNECTIONSTRING or ACS_ENDPOINT must be set.

> set EMAIL_SENDER=acs
> set ACS_CONNECTIONSTRING=endpoint=https://<resource>.communication.azure.com/;accesskey=<key>

When ACS_ENDPOINT is set, the tool authenticates using DefaultAzureCredential, which supports managed identity, workload identity, environment variables and developer credentials (such as az login). For a user-assigned managed identity, set AZURE_CLIENT_ID to the client id of the identity. The identity must be granted a role with permission to send email on the Communication Services resource.

> set EMAIL_SENDER=acs
> set ACS_ENDPOINT=https://<resource>.communication.azure.com/

Note that ACS ignores the display name of the sender: the sender address must be a MailFrom address of a domain linked to the resource, and the display name is configured there.

Example

The tool accepts a single argument, which is the name of a Json file.

> cat email.json
{
   "from": "Master Yoda <yoda@dagobah.sw>",
   "to": "Luke Skywalker <lskywalker19@tatooine.sw>",
   "subject": "Reminder",
   "htmlBody": "<h1>Use the force</h1>"
}
> dotnet lemail email.json

It is also possible to pipe JSON to the command:

> cat email.json | dotnet lemail --stdin

Usage patterns

The tool supports all of the following usage patterns to construct the email message to send:

  • JSON (file, or piped in)
  • Environment variables, only if --env is provided)
  • CLI options

Json format

The format of the file is as follows:

Property Type M/O Description
from Email Mandatory Email sender
to Email, or Array of Emails Mandatory Email recipients
cc Email, or Array of Emails Optional Additional email recipients
bcc Email, or Array of Emails Optional Non-disclosed email recipients
subject String Mandatory Subject of email message
textBody String, or @Filename Mandatory Plain-text body
htmlBody String, or @Filename Mandatory HTML body

An Email can be expressed as follows:

  • lskywalker19@tatooine.sw - Just the e-email address
  • Luke Skywalker <lskywalker19@tatooine.sw> - With display name

Environment variables

The following variables will be evaluated, but only if --env option is provided in the command line.

Env Type Description
EMAIL_FROM Email Sender email address
EMAIL_TO Emails Semi colon seperated list of recipients
EMAIL_SUBJECT String Subject
EMAIL_HTML File File name of HTML body
EMAIL_TEXT File File name of text body

CLI options

> dotnet lemail --help
Email sender

Usage: lemail [options] <InputFile>

Arguments:
  InputFile       Input JSON file

Options:
  --version       Show version information.
  -f|--from       Sender email address
  -t|--to         Recipient email address
  -s|--subject    Subject
  -h|--html-file  HTML file
  -x|--text-file  Text file
  -X|--text       Text content
  --stdin         Read JSON from stdin
  -e|--env        Load sender/recipient from environment variables
  -?|--help       Show help information
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last Updated
0.2.0 131 10/20/2026
0.1.2 2,801 3/18/2026
0.1.1 873 3/18/2026
0.1.0 146 3/18/2026
0.0.6 188 1/5/2026
0.0.5 173 1/5/2026
0.0.4 172 1/5/2026
0.0.3 163 1/4/2026
0.0.2 162 1/1/2026
0.0.1 154 1/1/2026