Using sendmail

Sendmail

sendmail(8) on OpenBSD allows you to queue mail to be sent by smtpd(8). The message is read from standard input (stdin) until the end-of-file.

$ sendmail -v -F fromname -f from@example.org to@example.com
From: from@example.org
To: to@example.com
Subject: Alpha Bravo
Message-ID:  <randomstring@example.org>
Date: Thu, 24 Jul 2025 11:41:35 -0700
MIME-Version: 1.0 
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Charlie Delta Echo Foxtrot

Replace fromname with the name of the sender, from@example.org with the sender's address, and to@example.com with the email to send to.

Press ctrl+d for end-of-file to end the letter.

NOTE: The letter must be RFC-compliant.

smtpd(8) should provide the following output:

<<< 220 example.com ESMTP OpenSMTPD
>>> EHLO localhost
<<< 250-example.com Hello localhost [local], pleased to meet you
<<< 250-8BITMIME
<<< 250-ENHANCEDSTATUSCODES
<<< 250-SIZE 36700160
<<< 250-DSN
<<< 250 HELP
>>> MAIL FROM:<from@example.org>  
<<< 250 2.0.0 Ok
>>> RCPT TO:<to@example.com> 
<<< 250 2.1.5 Destination address valid: Recipient ok
>>> DATA
<<< 354 Enter mail, end with "." on a line by itself
>>> .
<<< 250 2.0.0 379ec228 Message accepted for delivery
>>> QUIT
<<< 221 2.0.0 Bye

It's also possible to put the message inside a file, and to pipe that file to sendmail(8):

$ sendmail -v -F fromname -f from@example.org to@example.com < ~/letter