curl-library
Re: How to get only mailtext with libCurl C++?
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,
> "imaps://imap.gmail.com:993/INBOX/;UID=*;SECTION=HEADER%2EFIELDS%20%28SUBJECT%29
> <http://imap.gmail.com:993/INBOX/;UID=*;SECTION=HEADER%2EFIELDS%20%28SUBJECT%29>");
>
> 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:
--5f483268c60263d812005f9f6201
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:
imaps://imap.gmail.com:993/INBOX/;UID=*/;SECTION=1/;PARTIAL=0.200
For more information on SECTION 1 (TEXT/PLAIN refer to BODY[<section>])
and PARTIAL see 6.4.5 and 6.4.6 of RFC1730:
https://tools.ietf.org/html/rfc1730#section-6.4.5
-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2016-02-27