Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Address parsing support (RFC 5322 3.4) #34

Closed
theduke opened this issue Jan 24, 2019 · 5 comments
Closed

Address parsing support (RFC 5322 3.4) #34

theduke opened this issue Jan 24, 2019 · 5 comments

Comments

@theduke
Copy link

theduke commented Jan 24, 2019

It would be great if mailparse contained a function for parsing address specifications. (RFC 5322 3.4).

Something like:

fn parse_address(raw: &[u8]) -> Result<Vec<Address>, AddressParseError>;

struct Address {
   pub display_name: Option<String>,
   pub address: String,
}
@staktrace
Copy link
Owner

That sounds like a good idea. I'll try to find some time to implement this, but PRs are welcome.

@theduke
Copy link
Author

theduke commented Jan 24, 2019

The email-format crate contains very extensive parsing and AST-like definitions in general, including mailbox/address information.

Might be worth checking that out.

Currently I'm using both crates side by side because mailparse seems well written to me and handles body parsing well, while email_format has much more comprehensive header parsing infrastructure.

@eaon
Copy link

eaon commented Jan 24, 2019

Shameless self-promotion, I made this: https://crates.io/crates/email-address-list and am currently using it in conjunction with mailparse. Though given its API and dependency on Pest, I doubt it would fit into the codebase of mailparse directly.

@theduke
Copy link
Author

theduke commented Jan 25, 2019

Just a heads up: email-format panics all over the place, definitely not recommended!

@eaon your crate seems to work fine on real world data, so 👍 .

@staktrace
Copy link
Owner

Some guidelines if anybody wants to try a PR before I get around to implementing it: I would like this code to live in a new module, addrparse.rs (similar to dateparse.rs) and have zero external crate dependencies. Keeping the crate dependency graph small is something I actively strive for.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants