cURL / Mailing Lists / curl-library / Single Mail


Re: How to get only mailtext with libCurl C++?

From: Ray Satiro via curl-library <>
Date: Sat, 27 Feb 2016 14:48:46 -0500

On 2/27/2016 11:32 AM, Jules van der Toorn wrote:
> Hi,
> Recently is asked how to only get the subject of an email, and you
> responded with this:
> curl_easy_setopt(curl, CURLOPT_URL,
> which works perfectly. However, now i want to know how to only receive
> the mailtext (or better: how to only receive the first line of the
> mailtext).

I don't think there's any command that will retrieve only the first
line. Also are you sure you want only the first line and not the first
sentence? Long sentences may be split over multiple lines. Also, if the
mail is not plaintext the first line may be a content boundary. For example:

Content-Type: text/plain; charset=UTF-8

First line first line first line first line first line first line
second line second line.

Or if it's not multipart there may be no Content-Type shown. Try PARTIAL
to retrieve the first n bytes:


For more information on SECTION 1 (TEXT/PLAIN refer to BODY[<section>])
and PARTIAL see 6.4.5 and 6.4.6 of RFC1730:

List admin:
Received on 2016-02-27