Commit graph

113 commits

Author SHA1 Message Date
b37f8995da
Update Msg documentation for clarity and RFC compliance
Enhanced the documentation for several Msg methods to provide clearer explanations and include relevant RFC references. This includes improved descriptions of functionality, parameter details, return values, and links to pertinent RFC sections.
2024-10-05 19:34:37 +02:00
c520925457
Enhance documentation for email address methods
Detailed doc comments have been added to various methods handling "From", "To", "CC", "BCC", and "Reply-To" email addresses within the Msg class. The new comments follow RFC 5322 standards and provide explicit descriptions of the functionality and validation rules for each method. This improves code readability and maintainability. Additionally, moved the `addAddr` function to a more appropriate position within the file.
2024-10-05 19:11:16 +02:00
3d5435c138
Update EnvelopeFromFormat documentation in msg.go
Expanded the documentation for the EnvelopeFromFormat method to clarify its purpose, usage, and compliance with RFC 5322. Added details on how the envelope from address is used in SMTP communication and validation requirements.
2024-10-05 13:59:24 +02:00
1dcdad9da1
Enhance address header methods with detailed documentation
Updated comments in `header.go` and `msg.go` to provide more detailed explanations and references to RFC 5322. This improves clarity on how headers are set and utilized, and the conditions under which they operate.
2024-10-05 13:56:47 +02:00
78e2857782
Update method comments to include additional context and RFC references
Enhanced the comments for various methods in `msg.go`, `client.go`, `auth.go`, and `encoding.go` to provide more detailed explanations, context, and relevant RFC references. This improves the clarity and maintainability of the code by providing developers with a deeper understanding of each method's purpose and usage.
2024-10-05 13:39:21 +02:00
c186cba2c2
Refactor MsgOption comments for clarity
Revised the comments for MsgOption functions to provide clearer explanations of their purpose and usage. Added detailed descriptions for options such as WithMIMEVersion and WithBoundary to clarify their contexts and constraints.
2024-10-05 12:48:09 +02:00
682f7a6ca5
Clarify Msg struct field comments
Updated comments for all fields in the Msg struct to provide clearer and more detailed explanations. This includes specifying the data type for each field and the role they play within the Msg struct, making the code easier to understand and maintain.
2024-10-05 12:35:15 +02:00
cd4c0194dc
Refactor comments for clarity and detail
Enhanced the descriptive comments for error variables, constants, and types to provide clearer and more detailed explanations. This improves code readability and ensures that the purpose and usage of different elements are better understood by developers.
2024-10-05 12:15:01 +02:00
77920be1a1
Remove unnecessary error handling
Eliminated redundant error handling for random number generation as errors from these functions do not require special attention. This reduces code complexity and improves readability.
2024-09-20 20:39:50 +02:00
69e211682c
Add GetMessageID method to Msg
Introduced GetMessageID to retrieve the Message ID from the Msg
2024-09-19 11:46:53 +02:00
590dfe97e7
Refactor error handling for nil template pointers
Replace fmt.Errorf with errors.New for consistency in error handling. This change ensures a more streamlined and uniform error reporting approach across the codebase. Also updated a test case from t.Errorf to t.Error for better readability.
2024-08-16 10:16:53 +02:00
Alexander Setzer
7caf0b8e19 Fix typo / inconsistency for (*Msg).SetAttachments 2024-08-14 14:55:08 +02:00
b88b67e2c7
Add GetBoundary method and corresponding test
The GetBoundary method has been added to the Msg struct in msg.go. Alongside this, a corresponding test method, TestMsg_GetBoundary, was introduced in msg_test.go to ensure the proper working of GetBoundary. This new method returns the boundary string of the Msg, which was previously inaccessible.
2024-07-02 10:58:13 +02:00
2e548512c6
Merge branch 'refs/heads/main' into feature/145_add-eml-parser-to-generate-msg-from-eml-files 2024-05-16 15:17:47 +02:00
19a3cf61ed
Refactor variable names for code readability
Updated variable names in multiple files to enhance code readability and maintainability by replacing abbreviations with full descriptive names. This ensures adherence to the best practices of naming conventions in Go.
2024-02-27 11:21:28 +01:00
c0cf31b6c4
Merge branch 'main' into feature/179_refactor-variable-names-for-readability 2024-02-26 20:57:37 +01:00
b2f735854d
Refactor variable names for readability in reader.go
Variable names in reader.go have been changed to be more expressive for improved readability. 'buf' and 'off' were renamed to 'buffer' and 'offset' respectively throughout the file. The changes also include corresponding adjustments in code comments and related test cases, contributing to consistent and understandable code.
2024-02-26 00:56:29 +01:00
c455b45a3e
Refactor variable and function names for improved clarity in msg.go
The change updates various variable and function names in msg.go to make the code more intuitive. Updated names better capture what they represent or do, improving code readability and maintainability. This refactor does not impact functionality or logic of the code.
2024-02-24 21:26:55 +01:00
4e880ab31c
Refactor variable and function names for improved clarity in msg.go
The change updates various variable and function names in msg.go to make the code more intuitive. Updated names better capture what they represent or do, improving code readability and maintainability. This refactor does not impact functionality or logic of the code.
2024-02-24 18:26:30 +01:00
263f6bb3de
Refactor SMTP client code for better readability
The variable names in the code related to the I/O of the SMTP client have been clarified for improved readability and comprehension. For example, unclear variable names like `d` and `w` have been replaced with more meaningful names like `depth` and `writer`. The same naming improvements have also been applied to function parameters. This update aims to enhance code maintenance and simplify future development processes.
2024-02-24 12:43:01 +01:00
grigorii
a24906d185 Add an option to skip adding a User-Agent 2024-02-23 14:41:58 -08:00
f759b1b5fb
Merge branch 'main' into feature/145_add-eml-parser-to-generate-msg-from-eml-files 2024-02-08 17:04:06 +01:00
a864be059c
Add "X-Auto-Response-Suppress" header and update SetBulk method
A new "X-Auto-Response-Suppress" header has been added. The SetBulk method has been updated to include this new header, as it is recommended for automated emails. This functionality is tested in the msg_test.go file.
2024-02-08 16:45:06 +01:00
bda6b8c899
Merge branch 'main' into feature/145_add-eml-parser-to-generate-msg-from-eml-files 2024-02-05 13:00:21 +01:00
ef86a1a1fb
Add Charset support for message parts
Charset support has been added in the 'Part' struct. A 'SetCharset' method and a 'WithPartCharset' option have been added to override the default Part charset. The 'writePart' function in msgWriter now accommodates the charset defined at the Part level, defaulting to the previous functionality if not set.
2024-01-31 16:28:41 +01:00
f7ba3a1d02
Merge branch 'main' into feature/145_add-eml-parser-to-generate-msg-from-eml-files 2024-01-25 11:21:38 +01:00
0b622368ba
#166: Add delivery status indication for messages
This update introduces a new property, `isDelivered`, in the message struct to track if a message has been successfully sent or not. Additionally, this also includes a new helper function `IsDelivered` to easily retrieve the status. This feature enhances the tracking capabilities of outgoing messages across different client files.
2024-01-23 11:01:08 +01:00
8b19e497a0
Merge branch 'main' into feature/145_add-eml-parser-to-generate-msg-from-eml-files 2024-01-10 11:07:54 +01:00
rami
bd6250a8c2 Added return error to fileFromReader 2023-12-24 17:04:55 +01:00
a12d9c327f
Merge branch 'main' into feature/145_add-eml-parser-to-generate-msg-from-eml-files 2023-12-07 13:21:30 +01:00
da21550dc9
Fix potential null pointer exceptions in msg.go
This commit adds conditions in msg.go file to check if the header 'HeaderDispositionNotificationTo' key exists in the map 'm.genHeader' before trying to associate it with a value. This prevents potential null pointer exceptions.
2023-11-29 17:26:58 +01:00
ca896bd641
Refactor error checking in msg.SendErrorIsTemp()
Added an additional condition in the SendErrorIsTemp function within msg.go to ensure that the error e is not nil before referencing it. This guards against potential runtime panics from dereferencing a nil pointer, enhancing robustness of error handling.
2023-11-29 16:45:25 +01:00
a50a3ceb18
Add validation for nil STDERR or STDIN pipe
Introduced a new condition that checks and returns an error if either STDERR or STDIN pipe is nil in the msg function of msg.go. This improves error handling by preventing potential panic due to referencing a nil pipe.
2023-11-29 16:43:50 +01:00
1a166770b7
Update range loop to improve msg function readability
Converted the range loop in the GetAddrHeaderString function in msg.go to use value semantics rather than index notation. This improves code clarity by not unnecessarily referring to m.addrHeader[h] in the loop and instead referencing the value directly (using variable mh), making it easier to understand and maintain.
2023-11-29 16:42:07 +01:00
468e1e2b2c
Protect against empty address list, refactor error handling
Added a condition to prevent assignment of an empty address list to the 'HeaderFrom' scenario. This eliminates potential runtime errors when trying to access an nonexistent element of a slice.
Adjusted error handling in the sendmail execution part by reusing the 'err' variable, promoting cleaner, more readable code.
2023-11-20 18:36:19 +01:00
1e447b5f2c
Merge branch 'main' into feature/145_add-eml-parser-to-generate-msg-from-eml-files 2023-11-10 18:23:52 +01:00
cc14864129
#152: Add new methods and tests for handling email addresses
Added new methods `ToFromString()`, `CcFromString()` and `BccFromString()` in msg.go file to handle strings of comma-separated email addresses.
2023-11-10 18:07:56 +01:00
6bda5d1aaa
Merge branch 'main' into feature/145_add-eml-parser-to-generate-msg-from-eml-files 2023-10-20 14:23:24 +02:00
leahoop
3c2c106cb4 #147 add remove attachments and embeds methods 2023-10-20 10:21:03 +08: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
438cfd60eb
Preparation for the v0.4.0 release:
- Bump version in doc.go
- Add sonarlint to .gitignore
- Update README to reflect the changes and contributors
- Fixed typos in auth_cram_md5_118.go, msg.go, msg_test.go, reader.go and smtp_ehlo_117.go
2023-05-31 09:34:45 +02:00
Christian Vette
20fe4cd751
fix: parsing of ReplyTo with special characters 2023-03-07 10:51:15 +01:00
fa0b9709f6
Correct method names in caveat comment 2023-01-31 21:57:10 +01:00
d33f0e8004
Merge branch 'main' into feature/107_provide-more-ways-for-middleware-to-interact-with-mail-parts 2023-01-31 20:47:36 +01:00
dab860834a
Adding PGPType to Msg as preparation to support PGP/MIME in go-mail-middleware 2023-01-31 18:35:48 +01:00
c9794069cd
Add Caveat note about the io.Reader methods being memory inefficient 2023-01-31 17:48:19 +01:00
e66ad2be1a
Fix Attach/EmbedReader and implement Attach/EmbedReadSeeker
This PR addresses #110.
`Msg.AttachReader()` would not output the attached file after consecutive writes (e.g. a write to a file and then send via Client).

This PR fixes this behaviour by first reading the io.Reader into memory and then creating a new `bytes.Reader`, which does support seeking. In the writeFunc we then seek to position 0 after a successful `io.Copy`. This is probably not the most memory efficient way of handling this, but otherwise we'll have to break the `io.Reader` interface.

Additionally, a new way of attaching/embedding files has been added: `Msg.AttachReadSeeker()` and `Msg.EmbedReadSeeker()` which take a ´io.ReadSeeker` as argument instead. These two methods will skip the reading into memory and make use of the `Seek` method of the corresponding interface instead.
2023-01-31 17:38:31 +01:00
25e00c64e2
Introduce GetEmbeds() and SetEmbeds()
These two methods work analogous to the `*Attachments()` methods and provide the user with access to the embedded files.
2023-01-29 13:48:51 +01:00
9724a2b523
Introducing Msg part deletion
This PR introduces a new struct field for the message parts: `del`

If the del flag is set to `true`, the msgWriter will ignore this part during the writing process.

Additionally, the `part` has now a `Delete` method that lets the user mark the part as deleted

This allows middleware to take further control of the Msg and is part of #107
2023-01-28 14:39:14 +01:00
3922d3f195
Switched copyright header from me to "The go-mail Authors" 2023-01-15 16:14:19 +01:00