Using curl as a smtp client to send an email

curl can be used to send a test email to a smtp server like this:

curl smtp://localhost:2525 --mail-from "test-sender@test.com" --mail-rcpt "test1@test.com" --upload-file test-email.txt

Where test-email.txt contains you test email content:

From: "User Name" <test-sender@test.com>
To: "Test1" <test1@test.com>
Subject: Test email 1

This is a test email

If you also add the -v verbose option for curl you can see the STMP exchange with the server:

* Host localhost:2525 was resolved.
* IPv6: ::1
* IPv4: 127.0.0.1
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Trying [::1]:2525...
* Connected to localhost (::1) port 2525
< 220 af54c17beae6 smtp4dev ready
> EHLO test-email.txt
< 250-Nice to meet you.
< 250-8BITMIME
< 250-SIZE
< 250-SMTPUTF8
< 250-AUTH=CRAM-MD5 PLAIN LOGIN XOAUTH2
< 250 AUTH CRAM-MD5 PLAIN LOGIN XOAUTH2
> MAIL FROM:<test-sender@test.com> SIZE=114
< 250 New message started
> RCPT TO:<test1@test.com>
< 250 Recipient accepted
> DATA
< 354 End message with period
} [119 bytes data]
* upload completely sent off: 119 bytes
< 250 Mail accepted
104 114 0 0 104 119 0 2075 --:--:-- --:--:-- --:--:-- 2087
* Connection #0 to host localhost left intact