Commit graph

13 commits

Author SHA1 Message Date
53566a93cd
Add content type, charset processing and refactor encoding process
Extended the settings for content type and charset from headers. Also, refactored the handling of encoding types - 'QP' and 'B64' - within the mail header and body parsing sections. The process of handling encoding for plain type mail specifically is now encapsulated in a new function, parseEMLBodyPlain. These changes enhance code readability, maintainability, and error handling efficiency.
2024-02-09 15:56:39 +01:00
4202f705a0
Refactor variable naming and multipart parse function in eml.go
The variable names "mbbuf", "mt", and "par" have been renamed to "bodybuf", "mediatype", and "params" respectively, for clarification. Moreover, the multipart parsing block within the parseEMLBodyParts function was extracted into its own function, parseEMLMultipartAlternative, for improved code structure and readability.
2024-02-09 12:34:11 +01:00
60222c95e7
Add multipart message parsing in eml.go
This commit introduces the ability to handle multipart messages within the eml.go file. It reads individual parts of multipart messages, sets the encoding and content for each part, and implements error handling for potential issues like a missing boundary tag or difficulties acquiring the next part of a multipart message.
2024-01-22 17:49:58 +01:00
f9140ce90e
Add parsing of EML from string and reader
Added two new methods `EMLToMsgFromString` and `EMLToMsgFromReader` in "eml.go". They allow EML parsing directly from a given string and a reader object, increasing overall functionality and versatility of the EML parsing process. This will enable the users to parse EML documents more flexibly."
2023-10-31 11:45:09 +01:00
2bba7b902b
Updated error handling and encoding comparison in EML parsing
This commit changes the usage of error value and improves the string comparison for encoding types in EML file parsing. It ensures file closure after read operations to avoid memory leaks. Error messages are made dynamic for improved error reporting. Comments on function has also been made more descriptive.
2023-10-17 10:41:42 +02:00
54ccb80925
Add base64 support in email parser
Implemented base64 encoding support in the email parser. This addition allows the parser to read and decode base64 encoded emails.
2023-10-13 16:27:57 +02:00
a3b3deb467
#145: Support for quoted-printable encoding in email parser
Added support for quoted-printable encoding in email parser to increase its functionality. The change includes a case handling feature for 'EncodingQP' and related conversions to allow for proper message body reading and encoding setting. This improves the robustness and the scope of email content types that the parser can handle."
2023-10-13 16:04:07 +02:00
e7c717d0fc
"Rename Mime10 to MIME10 in codebase
Renamed field 'Mime10' to 'MIME10' across multiple files for canonical representation and consistency with standard MIME naming format in the protocol."
2023-10-13 15:23:28 +02:00
07a3450103
Added SPDX license header 2023-10-13 15:08:53 +02:00
f60b689b03
Refactor EML file parsing and header extraction
We can no parse simple mails (multipart is not working yet). The existing implementation was made more efficient by refactoring the EML file parsing and header extraction mechanism. Added 'strings' and 'bytes' packages to facilitate these changes. Previously, headers and body were parsed separately which was unnecessarily complex and increased the chance of errors. Now, with the new function 'readEML' and the helper function 'parseEMLBodyParts', we are able to parse headers and body together which not only simplifies the code but also increases its reliability. Specifically, 'bytes.Buffer' now helps us capture body while parsing, which removes need for separate handling. Additionally, certain headers like 'charset' and body types are also accounted for in the new implementation, enhancing the completeness of information extracted from EML files.
2023-10-13 15:06:28 +02:00
3d50370a4c
Extract and set charset from email content type
The diff modifies how the email library handles the extraction of the mime media type from an email header. It uses the mime.ParseMediaType function to parse the content type header. The function gives back the media type as a string and a mapping of different associated parameters. This mapping was previously just printed, but now the charset parameter is also used for setting the charset of the email if it exists.
2023-09-27 11:29:58 +02:00
d733b6e17d
Making slight progress on EML parsing 2023-09-21 13:50:36 +02:00
d8d2a6e714
Add EML parsing functionality to mail package
Added two new functions `EMLToMsg` and `readEML` to the `mail` package. `EMLToMsg` function opens and parses a .eml file and returns a pre-filled Msg pointer. `readEML` opens an EML file and uses net/mail to parse the header and body. These changes are made to provide support for EML file parsing, which is a common requirement in many email-based applications.
2023-09-15 13:16:14 +02:00