curl / Mailing Lists / curl-users / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Curl not sending last lines of SMTP connection to stderr file

From: Jon Harris <>
Date: Wed, 22 May 2019 02:07:32 +0000

I am sending an email using curl SMTP. I have set options for verbose output and redirecting stderr to a file. Here is my command line:

curl smtp:// --mail-from --mail-rcp -s --upload-file msg_23.txt -v --stderr msg_23.log

Most of the verbose output gets captured to msg_23.log. However, the QUIT and 221 response are printed out on the console. So I see this:

# curl smtp:// --mail-from --mail-rcp -s --upload-file msg_23.txt -v --stderr msg_23.log
< 221 See you later alligator

It's like it stops redirecting stderr before it prints the last 2 headers.

In contrast, a system-level redirection of stderr captures all output including the last 2 lines:
# curl smtp:// --mail-from --mail-rcp -s --upload-file msg_23.txt -v 2>msg_23.log

Is this a bug? The system-level redirection provides a work-around, though the --stderr flag is preferable for my application.

Jon Harris, Sr. Design Engineer, Symetrix, Inc.

Received on 2019-05-22