Commit graph

29 commits

Author SHA1 Message Date
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
c126670f70
Refactor variable and function names in msgWriter
The commit includes changes such as renaming the variables `wbuf` to `buffer`, `cl` to `charLength` and functions `f` to `writeFunc` in msgWriter. This refactoring makes the code easier to read and understand. All the changes are aimed at enhancing code clarity without altering underlying logic or functionality.
2024-02-24 17:38:42 +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
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
b63d4803f1
Refactored null checks in msgwriter.go
Extended null check conditions in msgwriter.go to prevent potential nil pointer dereference. This change ensures robustness in error handling in scenarios where FROM header or envelope FROM is either not existent or nil.
2023-11-29 16:56:32 +01:00
edd6051df3
#138: Add error handling to message writing process
In the updated version of msgwriter.go, an additional error handling process has been included. If an error is detected when creating a new part in the message writer, this error is stored and prevents executing the writeBody function. This fixes nil pointer dereference in `mw.writeBody` if an error occured previously.
2023-08-08 10:59:10 +02:00
fe28247f9b
The additional multipart start/stop are not needed here 2023-01-31 21:54:32 +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
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
47eb7b582b
#81: Fix error handling in body writer
The error handling in the msgWriter.writeBody() method was not working properly. We basically overwrote the mw.err with nil if the function that followed after a failed write attempt was successful again

This patch fixes #81
2022-11-19 09:55:38 +01:00
2e60d070a6
Add SetHeaderPreformatted() method
With the SetHeaderPreformatted() method we have the ability to set headers that are already preformatted by the user and will not be altered in the mail message output
2022-10-26 15:33:03 +02:00
701cbbf399
Fixes a bug with attachments. Hopefully addresses #37 as well
By default, the encoding/base64 in Go does not add line breaks to its output.
This patch introduces the Base64LineBreaker which satisfies the io.WriteCloser interface
Attachments are now correctly broken up into maximum of 76 chars
2022-08-14 12:06:26 +02:00
31001e87b2
#24: Add SPDX license IDs for REUSE compliance
# SUMMARY

* Bad licenses:
* Deprecated licenses:
* Licenses without file extension:
* Missing licenses:
* Unused licenses:
* Used licenses: CC0-1.0, MIT
* Read errors: 0
* Files with copyright information: 45 / 45
* Files with license information: 45 / 45

Congratulations! Your project is compliant with version 3.0 of the REUSE Specification :-)
2022-06-17 15:05:54 +02:00
a50910b943
#21: Add possbility to set dedicated envelope from address
- Added `EnvelopeFrom()` and `EnvelopeFromFormat()` methods analogous to the `From()` `FromFormat()` methods
- Changed MsgWriter logic for envelope from addresses
- Adjusted `Msg.GetSender()` to return the envelope from first and only mail body from if the envelope is not set
2022-06-13 10:18:35 +02:00
894ff7128c
Rename Write() to WriteTo() so it satisfies the io.WriteTo interface 2022-05-24 15:46:59 +02:00
914a02b0be
Fix some code smell that was identified by SonarQube 2022-04-12 16:01:30 +02:00
030eba8cfd
Default header and sorting
- Default headers are set in its own method now
- Generic headers are now sorted before being written
2022-03-20 19:11:58 +01:00
d448f0566b
v0.1.6b: writeHeader() was producing double spaces at line breaks 2022-03-20 18:18:06 +01:00
b852a5281a
v0.1.6: Fix in writeHeader() and User-Agent
- The writeHeader() method wasn't producing good output for long headers. This has been fixed
- Added a VERSION string to the library
- If both no User-Agent and no X-Mailer header are set, the lib adds a default UA-header
2022-03-20 17:38:46 +01:00
68049b568d
Another fix for the written byte counting, this time for parts (alt/attach/embed) 2022-03-19 18:32:51 +01:00
d6f131c36d
Fix in writeBody method which returned wrong bytes amounts for encoded message bodies 2022-03-19 16:56:14 +01:00
709b4e6b91
Switched write functions to return the number of bytes. Due to failing tests in Msg.Write() 2022-03-18 17:08:05 +01:00
a87577d388
Attachment names should probably be encoded 2022-03-15 12:12:45 +01:00
1157180369
v0.1.1: Added embeds/attachments 2022-03-14 10:29:53 +01:00
13f4c54a27
Make GoLinter happy 2022-03-13 20:04:30 +01:00
fd04243ebf
Fix for msgwriter.go 2022-03-13 19:04:58 +01:00
8c804ec573
Implemented MIME multipart handling for alternative content 2022-03-13 17:15:23 +01:00
06e37755f2
Some progress was made:
- Implemented proper AUTH LOGIN mechanism
- Implemented msgWriter for handling io
- Implemented proper mail header formatting/output
- Minor refactoring
2022-03-12 15:10:01 +01:00