Commit graph

1367 commits

Author SHA1 Message Date
0cf9efcc69
Update SMTP authentication mechanisms and related tests
Introduced the SMTPAuthNoAuth mechanism in the auth.go file meant for instances where authentication is not required or supported. Adjusted tests in client_test.go to account for this new mechanism. Minor order modifications were also made to the list of supported SMTP AUTH types and respective tests for better consistency.

Closes #176
2024-02-22 15:24:19 +01:00
b957445489
Merge branch 'main' into feature/145_add-eml-parser-to-generate-msg-from-eml-files 2024-02-15 12:14:45 +01:00
56512b5bd9
Update doc.go
Bump version to 0.4.1
2024-02-14 16:12:13 +01:00
f5bbc558b2
Merge branch 'main' into feature/145_add-eml-parser-to-generate-msg-from-eml-files 2024-02-10 15:12:25 +01:00
93611e47a5
Merge pull request #174 from wneessen/go_122
Update Go version in GitHub workflow files
2024-02-10 15:09:20 +01:00
f01047855f
Update Go version in GitHub workflow files
The Go version has been updated to '1.22' in the 'sonarqube.yml', 'golangci-lint.yml', and 'codecov.yml' GitHub action workflow files. This includes an additional modification for the Go versions matrix and condition statements in the 'codecov.yml' workflow.
2024-02-10 14:14:34 +01:00
3facbde703
Add new content types and refactor message writer
Introduced "multipart/mixed" and "multipart/related" content types in encoding.go and updated msgwriter.go to accommodate these. Adjustments made in related tests for these new types. Additionally, removed unnecessary print statements and improved multipart alternative parsing in eml.go.
2024-02-10 13:36:42 +01:00
59e85809f7
Refactor multipart encoding handling and improve content parsing
Refactored the processing of multipart encoding to be robust and easily maintainable. The changes include setting 'QP' encoding as default when the Content-Transfer-Encoding header is empty, accounting for the removal of this header by the standard Go multipart package. Also, parser functions for content type and charset are now independently handling the headers, replacing the split-string approach, thus improving efficiency and code readability.
2024-02-10 13:22:38 +01:00
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
f759b1b5fb
Merge branch 'main' into feature/145_add-eml-parser-to-generate-msg-from-eml-files 2024-02-08 17:04:06 +01:00
94f53fe040
Merge pull request #173 from wneessen/ms-autoresponse-suppres
Add "X-Auto-Response-Suppress" header and update SetBulk method
2024-02-08 16:59:15 +01:00
7a549242ae
Update Go version and clean up SMTP test suite
The Go version has been updated to 1.22 in the .golangci.toml file for compatibility reasons. Additionally, unnecessary white space has been removed from the smtp/smtp_test.go file to maximize code efficiency and readability.
2024-02-08 16:51:25 +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
64a07399c4
Merge pull request #172 from wneessen/feature/171_implement-per-part-charsets
Add Charset support for message parts
2024-02-05 12:59:43 +01:00
2f60d9c5df
Add support for HTML alternative message body
The code has been updated to allow for an HTML alternative to the plain text body in messages. This includes adding a new function to add this alternative body along with additional unit tests to ensure the multipart messages are properly constructed. The tests also check the correct usage of different charsets.
2024-02-05 11:46:06 +01:00
68088577ba
Add charset related tests and functionality
New unit tests have been introduced for WithPartCharset and SetCharset methods in part_test.go. Also, a GetCharset method has been implemented in part.go. These modifications ensure the robustness of charset handling within the application.
2024-02-05 11:41:10 +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
8da2abcf01
Merge branch 'main' into feature/145_add-eml-parser-to-generate-msg-from-eml-files 2024-01-31 11:35:32 +01:00
7dced4b056
Merge pull request #170 from wneessen/feature/105_enhance-default-tls-port
Add default ports and fallback behavior for SSL and TLS
2024-01-31 11:32:06 +01:00
1efac7fb67
Add new test cases for client functionalities and clean client code
Test cases have been added for numerous client functionalities including WithTLSPortPolicy option for the NewClient method, Client.SetSSLPort method, and the Client.DialWithContext method with the fallback port functionality. Minor code simplification has also been performed in the 'SetSSLPort' function in client.go file.
2024-01-31 11:22:01 +01:00
4a90c2de62
Add additional SSL and TLS tests in client_test.go
Enhanced the unit tests in client_test.go by adding more test cases for SSL Port and TLS Port Policy. These additions contribute to more effective coverage of edge cases and increase the robustness of the test suite.
2024-01-25 16:56:15 +01:00
80893bd27a
Merge branch 'main' into feature/105_enhance-default-tls-port 2024-01-25 14:03:43 +01:00
1c39dc8cf8
Upgrade codecov-action to v3 in GitHub workflow
The codecov-action version used in the GitHub workflow file has been upgraded from v2 to v3. This enhances the reliability and performance by leveraging the new features and improvements available in version 3. This commit doesn't affect the functionality of the project but is more of a dependency update.
2024-01-25 14:03:19 +01:00
7a2d9ff938
#105: Add default ports and fallback behavior for SSL and TLS
Introduced default ports for SSL/TLS and STARTTLS connections in SMTP client. Also added fallback behavior, allowing the client to attempt connections on port 25 using plaintext if secured connections fail. Deprecated old methods and implemented new ones to enforce these changes effectively.

This is a copy of the PR muhlemmer:enhance-default-tls-port by @muhlemmer. Since they unfortunately didn't reply in the PR anymore I cloned the PR. They will be fully attributed in the PR, though.
2024-01-25 13:39:02 +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
161381d880
Merge pull request #169 from wneessen/update_cirrusci
Update FreeBSD version in .cirrus.yml
2024-01-23 12:37:13 +01:00
697584b311
Update FreeBSD version in .cirrus.yml
The FreeBSD version used for testing in .cirrus.yml has been updated from 12.4 to 14.0. This change ensures that the tests run on the latest stable version of the operating system, providing more reliable and up-to-date test results.
2024-01-23 12:31:30 +01:00
99dd296486
Merge pull request #167 from wneessen/feature/166_no-easy-way-to-determine-if-e-mail-was-send
Add delivery status indication for messages
2024-01-23 11:44:45 +01:00
6746af4605
Update client tests for message delivery indication
This commit adds checks in the testing functions to verify the successful implementation of message delivery status. A new attribute `isDelivered` is now being validated in our tests, reinforcing the message tracking system and enhancing the overall reliability of our application.
2024-01-23 11:21:56 +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
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
0d9ba278fe
Update common content types in encoding.go
The list of common content types in encoding.go has been revised. The type "multipart/alternative" has been added and the order of types has been adjusted for consistency with net/smtp upstream.
2024-01-22 17:48:49 +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
e4927fde82
Merge pull request #165 from wneessen/sync-net-smtp-upstream
Upstream sync / refine function comments to include return type GoDoc links
2024-01-10 11:06:57 +01:00
5dbb1e6dde
Refine function comments to include return type details
This is a sync with the net/smtp upstream as committed here: 1d45a7ef56 (diff-4f6f6bdb9891d4dd271f9f31430420a2e44018fe4ee539576faf458bebb3cee4).
2024-01-10 11:05:34 +01:00
01e5deb357
Merge pull request #163 from james-d-elliott/feat-auth-login-x-draft
feat(smtp): auth login extension draft support
2024-01-07 11:30:09 +01:00
James Elliott
a73a914fb2
feat(smtp): auth login extension draft support
This adds support for the auth login extension draft.
2024-01-07 13:34:33 +11:00
6cb8290e13
Merge pull request #161 from rami-dabain/main
Added return error to `fileFromReader`
2023-12-25 14:23:29 +01:00
rami
f445a55f7b Fixed msg_test.go 2023-12-25 12:17:55 +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
d5b410dca4
Merge pull request #157 from wneessen/nil_checks
Eleminate potential null pointer exceptions
2023-11-30 10:02:13 +01:00
6268077b99
Make golangci-lint happy
Omitting nil redundant nil checks, as len() for []string is defined as zero
2023-11-30 09:14:31 +01:00
5dcbe712ae
Add null check to prevent empty file handle error in msg_test.go
Implemented a null check to ensure the 'fi' file handle is not empty. With the absence of this check, the test was continuing even when 'fi' was empty, leading to null pointer exceptions further down in the code.
2023-11-29 17:47:30 +01:00
ddcad3710d
Fix potential null pointer exceptions in msg_test.go
Added robustness and improved error handling in msg_test.go by adding null checks before calling values from the genHeader map in RequestMDNTo and related functions. This enhancement was necessary to avoid the operations on non-existing keys and potential null pointer exceptions.
2023-11-29 17:46:30 +01:00
fb17547e69
Improve error handling in msg.go
Added additional checks when calling values from the genHeader map in msg.go file. This is to prevent trying to operate on non-existing keys, hence avoiding possible null pointer exceptions. The checks ensure the key HeaderMessageID exists in the genHeader map before attempting to operate on it. This is essential for functions like RequestMDNTo, RequestMDNToFormat, and RequestMDNAddToFormat, thereby improving the robustness of the code.
2023-11-29 17:40:31 +01:00
5a4f814061
Protect against key not found in genHeader map in msg.go
Added checks to ensure the key HeaderMessageID exists in the genHeader map before attempting to operate on it in msg.go. This will prevent possible null pointer exceptions when trying to assign the key a value or append it to the mids slice.
2023-11-29 17:34:15 +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