Commit Graph
234 Commits
Author SHA1 Message Date
Maurus Decimus 8d571e4c7e Fix: parse_date() does not handle UTC+12 and greater (fixes #148) 2026-06-21 08:02:57 +02:00
Maurus Decimus b905fda07d Reject dates with invalid month names 2026-05-10 11:15:48 +02:00
Maurus Decimus 2bff6e8d9d Fix panic with messages containing corrupted attachments (closes #145) 2026-05-02 09:15:12 +02:00
Teal Bauer ebd2b179df fix(html): skip style/script/template blocks in html_to_text (#134) 2026-02-24 19:45:37 +01:00
mdecimus af44d480ad v0.11.2 2026-02-14 18:43:43 +00:00
mdecimus 9122a32e08 Fix CRLF tests (closes #132) 2026-02-04 20:48:44 +01:00
mdecimus 7fada6e911 Clippy fixes 2026-01-29 11:04:22 +01:00
Cameron Little df057edf09 Fix broken receive header date parsing when tab is used in long header syntax (#130)
* Add example tests for broken received parsing in shapelib email

This comes from http://lists.maptools.org/pipermail/shapelib.mbox/shapelib.mbox, where several of the emails received headers are incorrectly parsed.

The bad parsing looks like this:

Original header value:

```
from [217.146.183.184] by nm2.bullet.mail.ukl.yahoo.com with NNFMP; 09 Mar 2011 11:19:46 -0000
```

```json
"date": {
  "year": 1911,
  "month": 219,
  "day": 3,
  "hour": 19,
  "minute": 46,
  "second": 0,
  "tz_before_gmt": true,
  "tz_hour": 0,
  "tz_minute": 0
}
```

Where the year should be 2011 and the month 3.

Weirdly, this reproduces in full message parsing, but not in the individual `received.json` tests.

This looks like it's similar to https://learn.microsoft.com/en-us/answers/questions/2737324/windows-live-mail-has-received-date-set-well-into

* Fix

* Add test case from https://github.com/stalwartlabs/mail-parser/issues/81
2026-01-15 00:18:34 +01:00
mdecimus 6c5d330285 Updated roundtip date conversion tests v0.11.1 2025-08-18 12:03:32 +01:00
mdecimus 957185aed4 v0.11.1 2025-08-18 11:56:55 +01:00
mdecimus c5d47b5b8e v0.11.0 v0.11.0 2025-05-11 16:29:41 +02:00
andreadev-it 0a07a6f3d4 Fixed typo in header.rs (#105) 2025-03-24 10:10:09 +01:00
Stephen Becker IV b29325709a fix-no-newline-parse (#102)
* fix-no-newline-parse

Dearest Reviewer,

Issue #90 brought up the issue that if there was no newline. the user
provided an easy reproduction case. I was able to track it down to the
parse raw function.

The issue is that the loop hits the end of the string and returns Empty.
However, if there is a start offset then some characters were found. This
code just checks the offset after the loop.

If this is not the correct behavior please close.

Thanks for your time
Becker

* pr feedback

Add break instead of duplicating code.
2025-03-09 18:25:07 +01:00
Stephen Becker IV 41a96cd647 fix-fuzz-targets (#103)
* fix-fuzz-targets

Dearest Reviewer,

While creating PR #102 I tried running the fuzz command and found it
failing. It looks like the functions were made private and parse headers
arguments were updated.

I dont know if this is a complete update or what is covered but it does
get `cargo +nightly fuzz run mail_parser` working again.

Thanks for your time.
Becker

* readd space
2025-03-02 18:37:17 +01:00
mdecimus b0ba8dba3b Clippy fix 2025-02-27 17:24:43 +01:00
sftse 60fe70d2c5 fix: express custom trait with stdlib traits (#101) 2025-02-09 15:53:53 +01:00
sftse 209778f080 Informing callers of buffering requirements prevents accidental double buffering (#100) 2025-02-09 15:52:22 +01:00
mdecimus 0bcf5f513c v0.10.2 2025-01-28 18:26:37 +01:00
mdecimus 3e300dd2c2 Fixed Headername::parse 2025-01-26 16:07:18 +01:00
mdecimus c177ffaca3 v0.10.0 v0.10.0 2025-01-26 15:31:53 +01:00
mdecimus fa34e10927 Moved HTML entity mappings to hashify large map 2025-01-26 10:18:46 +01:00
mdecimus 2b37017cf8 Fixed OOB 2025-01-25 18:15:29 +01:00
mdecimus 5f25e1291f REUSE licensing 2025-01-25 17:47:39 +01:00
mdecimus 8b2ad20bf3 Hashing with hashify + cosmetic fixes 2025-01-25 17:45:23 +01:00
sftse bc6a5b1e94 Retain mbox IO errors (#91)
* Simplify

* Clear line buffer explicitly

* Move line clearing outside logic branching

* Switch if-else branch order

* Delete needless branching, other branch early-returns, so this is equivalent

* fmt

* Inline return statement

* Equivalence transform of logic branches

* Equivalence transform of logic branches

* Hoist if across if let

* Delete else block

* Make explicit that !is_from holds implicitly for these branches

* Switch if let {...}; if {...} into if {...}; if let {...}

* Pull out common if check

* Merge common if clauses

* Introduce early continue

* Fixed clippy warnings

* Remove collecting into Vec

* Dont throw away IO error
2025-01-25 15:17:32 +01:00
sftse 20fa3dbd46 Fix deserialize (#93)
* Expand test to cover deserialization

* Fix deserialization
2025-01-25 15:15:10 +01:00
sftse e97d14ad89 Add .eml example with odd behavior (#88)
* Add .eml example with odd behavior

* Parse malformed, non-multipart, single text/plain messages best-effort as if text is not malformed
2025-01-25 15:14:19 +01:00
sftse ed16429bcc Hide concrete type behind impl type (#94)
Without this, the doc(hidden) interacts poorly with the fact that both
BodyPartIterator and AttachmentIterator can be seen in the public api of
other functions. The types still show up, but there's no simple way to know
they implement Iterator or what the Item they return is.
2025-01-25 15:12:27 +01:00
sftse c733600b75 Obsolete timezones (#95)
* Expand date time tests by section 4.3 Obsolete Date and Time from RFC5322

* Needless branching

* fmt

* Implement obsolete time zones RFC5322 section 4.3

* Sanity check: constrain hours below 12 and minutes below 60
2025-01-25 15:11:41 +01:00
sftse 76669a32c6 Folding ws between "Content-Type:" and "plain/text" leads to empty header (#96)
* Add testcase with folding whitespace between "Content-Type:" and "text/plain"

* Fix handling of newlines between Content-Type and the type itself
2025-01-25 15:10:27 +01:00
mdecimus c8bf355494 Multiline quoted continuations (closes #92) 2024-12-01 20:54:09 +13:00
mdecimus 9bf766dcf1 Clippy fixes 2024-12-01 20:18:17 +13:00
George 0eba00b4e9 Update lib.rs (#75)
For ergonomic reasons a default implementation for `DateTime` is useful and all zero's and false is fine, though some specific other value may be more suitable
2024-10-21 17:22:28 +02:00
sftse 0baffddb28 Minor fixes (#87)
* Move multipart classification into own closure

* Add classification enum

* Express classification indirectly with an enum

* Express logic clause in equivalent way, add assert inline test to make sure of it

* Remove old classifier

* Remove enum indirection

* Remove closure

* Hoist common if condition into outer scope

* Simplify expression

* Simplify lifetime bounds

A missing lifetime in the GetHeader trait was inferred by lifetime elision rules
to be shorter than necessary, leading to awkward lifetime constraints being
propagated throughout many functions that didnt need them.

* Prohibit Rust 2018 idioms, return longest feasible lifetimes

* Dont duplicate crlf in extension when saving failing results
2024-10-21 17:21:56 +02:00
董彬 54ca7df6eb Update multi_byte.rs (#86)
Under some extreme circumstances, the pre-allocated length might not be sufficient.
2024-09-08 18:18:48 +02:00
mdecimus c3f28cb4d1 v0.9.4 2024-09-04 09:10:33 +02:00
mdecimus e512a66bb0 More flexible charset name parsing (closes #85) 2024-08-30 17:04:00 +02:00
mdecimus 6a48ed69b6 Removed FUNDING 2024-08-09 18:28:23 +02:00
mdecimus dfda00c939 Fix nestead attachment contents and len functions (fixes #84) 2024-08-09 18:27:09 +02:00
mdecimus a96497d7a3 v0.9.3 2024-03-28 15:46:25 +01:00
Clément DOUIN ad4dff69c3 fix address name containing @ (#80) 2024-03-14 13:29:37 +01:00
Arif Driessen cf87d3556c initial commit (#77) 2024-02-07 13:48:28 +01:00
Mauro D 4ff4c57e2c Clippy fixes 2024-01-08 19:31:34 +01:00
Mauro D 598cba3b87 Added liberapay 2024-01-08 19:23:59 +01:00
sftse 716c0d747e correctly parse obsolete years as in RFC5322 section 4.3 (#72) 2024-01-05 18:28:36 +01:00
mdecimus 65533d3faf v0.9.2 v0.9.2 2023-11-27 09:34:59 +01:00
mdecimus 28a9b67b9a Fix Received struct serialization for bincode compatibility 2023-11-09 17:40:47 +01:00
mdecimus b6c080ff45 Updaded keywords v0.9.1 2023-09-22 13:39:53 +02:00
mdecimus 56d2c3b8b0 v0.9.1 2023-09-22 13:38:55 +02:00
mdecimus 816d944f2e Updated Rust version 2023-09-16 17:28:58 +02:00