I'm trying to send a simple e-mail with curl. SMTP has two caveats here: dot stuffing and CRLF, I've tried to test these in my sample e-mail.
This is the code, which is mostly the smtp example from curl source:
For the options, I've just added curl_easy_setopt(curl, CURLOPT_CRLF, 1L); to do CRLF conversions, and replaced \r\n in payload_text to see whether it works or not.
Bug #1: this example sends LF line endings on the wire, so my SMTP server refuses the e-mail. Shouldn't CURLOPT_CRLF convert them to CRLF?
Bug #2: dot stuffing doesn't happen. The lines with a dot in the first character aren't get prepended with an extra dot, so the transaction here fails (because of the lone LF.LF). If think an SMTP client should do this and not let the client take care of it.
Could you please investigate these?
$ curl -V
curl 7.39.0 (amd64-portbld-freebsd10.0) libcurl/7.39.0 OpenSSL/1.0.1i zlib/1.2.8
Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp smtp smtps telnet tftp
Features: AsynchDNS Largefile GSS-API SPNEGO NTLM NTLM_WB SSL libz TLS-SRP