Using curl/libcurl4 for sending mails

I'm trying to use curl or libcurl4 to send an email. The error I get is:
curl: (48) Error
What am I doing wrong or is this not possible?

I use this command:
curl --url 'smtps://' --mail-from '' --ssl-reqd --mail-rcpt '' --upload-file 'datenverbrauch.txt' --user 'username:passwd'

Thanks for your help, I also tried the same with libcurl4 and without "--upload-file"

Error code 48 in curl refers to "An unknown option was passed in to libcurl", which would be in line with OpenWrt's tendency to disable optional features for size reasons (apparently you can enable LIBCURL_SMTP when building from source).

1 Like
root@OpenWrt:~# curl --version
curl 7.85.0 (mips64-openwrt-linux-gnu) libcurl/7.85.0 mbedTLS/2.28.1 nghttp2/1.44.0
Release-Date: 2022-08-31
Protocols: file ftp ftps http https mqtt
Features: alt-svc HSTS HTTP2 IPv6 Largefile MultiSSL SSL threadsafe

It makes sense that it is stripped down and lightweight. Hopefully in the future there is a separate option for the full cURL also - I've been wanting HTTP/3 myself

So it is not possible to send emails like this by commandline?

Not using curl. But there are several command line packages available which could do the job. msmtp*, mailsend* and even postfix.

It might be, if you enable the SMTP feature in the curl package source code compile options and compile your personal version, like slh suggested.

The default package, downloadable by opkg, does not have the SMTP feature compiled in.