Commit graph

596 commits

Author SHA1 Message Date
e1098091c3
Refactor variable names in SMTP client code
The commit introduces improved variable names in the SMTP client code that are more expressive and better describe the function they perform. This is combined with corrections to some code comments. It's aimed to increase code readability and maintainability. Updates are made across the client_119.go and client.go files to ensure consistent naming conventions.
2024-02-24 22:06:18 +01:00
12a145f612
Fix typos in comments in tls.go
The comments within the tls.go file had multiple typographical errors which could have caused misunderstandings. These typos have been corrected to improve the clarity of the comments and maintain code understanding.
2024-02-24 21:46:48 +01:00
d81dee95a8
Refactor variable and function names for improved clarity in b64linebreaker.go
The existing variable and function names in the file have been updated for better readability. This change aids in code comprehension without affecting its functionality or logic. With accurately depicted names, the maintainability of the code is enhanced.
2024-02-24 21:38:20 +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
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
grigorii
a24906d185 Add an option to skip adding a User-Agent 2024-02-23 14:41:58 -08:00
68e6284e4e
Merge pull request #177 from wneessen/feature/176_noauth-smtpauth-type
Update SMTP authentication mechanisms and related tests
2024-02-22 15:49:16 +01:00
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
56512b5bd9
Update doc.go
Bump version to 0.4.1
2024-02-14 16:12:13 +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
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
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
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
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
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
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
fd313e23b6
Add checks for nil or empty Subject headers
Added condition checks in `msg_test.go` for nil or empty Subject headers in the assigned functions. If the Subject is found to be nil or its length is less than 1, an empty string is now appended to prevent issues arising from null pointers or non-existent Subject headers in email messages.
2023-11-29 17:26:47 +01:00
81306e4dd3
Fix null pointer exception in Is function
Updated the Is function in senderror.go to handle null values for SendError. This was done by adding a nil-check for surfaced pointer errors in the errors.As call. This prevents the function from attempting to derive values from a null pointer and consequently prevents null pointer exceptions from being thrown.
2023-11-29 17:20:09 +01:00
b79374224c
Handle nil buffer in Reader and update tests
Updated the Reader struct in reader.go to properly handle nil buffers. This prevents potential errors from nil pointer dereference. Also added the fmt package for debugging purposes. Correspondingly, additional tests in reader_test.go were also added to cover these edge cases and ensure the Reader struct correctly handles them.
2023-11-29 17:18:55 +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
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