letters icon indicating copy to clipboard operation
letters copied to clipboard

optionally only parse email headers

Open rorycl opened this issue 11 months ago • 0 comments

Hi @mnako

Based on a need to parse the headers of a lot of emails, I've suggested a small patch to optionally do this following the suggestion in Discussions here.

A couple of points.

  1. I thought the simplest way of making this change was to send an optional string to ParseEmail; eg: email, err := letters.ParseEmail(r, "HeadersOnly").

  2. The email struct is reinitialised in ParseEmail to set the Headers -- see deleted line 26. I've changed that.

  3. Partly because of 2. above I had an error in the test I copied and couldn't easily see what the error was. I used Google's go-cmp module which makes it easy to diff test errors.

This is my first github pull request. Please feel free to criticise it in any way.

Cheers! Rory

rorycl avatar Feb 29 '24 17:02 rorycl