-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 8a69889
Showing
5 changed files
with
565 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
MIT License | ||
|
||
Copyright (c) [2024] [Travis Peacock] | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
|
||
### Attribution | ||
|
||
If you use this software, please consider giving attribution to the original author and/or organization. For example, you can include the following in your documentation or README file: | ||
|
||
"This software uses the [name of software] by [author or organization name]. The software is available under the MIT License." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
# smtplmail | ||
|
||
smtplmail is a drop-in replacement for sendmail, designed to send emails from Linux systems using SMTP. It provides a simple way to configure and use SMTP for outgoing mail, making it easy to integrate with existing systems that expect sendmail functionality. | ||
|
||
## Features | ||
|
||
- Easy setup and configuration | ||
- Support for SSL, TLS, and unencrypted connections | ||
- Configurable via YAML file, environment variables, or command-line flags | ||
- Logging support with configurable log levels | ||
- Sendmail-compatible command-line interface | ||
|
||
## Installation | ||
|
||
1. Download the latest release binary from the [Releases](https://github.com/yourusername/smtplmail/releases) page. | ||
|
||
2. Run the setup process as root: | ||
|
||
``` | ||
sudo ./smtplmail --setup | ||
``` | ||
|
||
This will: | ||
- Prompt you for SMTP configuration details | ||
- Create the configuration file at `/etc/smtplemail/smtplemail.conf` | ||
- Move the binary to `/usr/local/bin/smtplmail` | ||
- Create a symlink at `/usr/bin/sendmail` pointing to the smtplmail binary | ||
|
||
## Configuration | ||
|
||
The configuration file is located at `/etc/smtplemail/smtplemail.conf`. Here's an example configuration: | ||
|
||
```yaml | ||
smtp_user: your_username | ||
smtp_password: your_password | ||
smtp_host: smtp.example.com | ||
smtp_port: "587" | ||
smtp_security: TLS | ||
send_from: [email protected] | ||
log_file: /var/log/smtplemail/smtplemail.log | ||
log_level: error | ||
``` | ||
You can also set these values using environment variables or command-line flags. | ||
## Usage | ||
smtplmail can be used as a drop-in replacement for sendmail. It accepts email content via stdin and supports various command-line flags: | ||
``` | ||
smtplmail [options] recipient1 [recipient2 ...] | ||
``` | ||
|
||
### Command-line Options | ||
|
||
- `-f`: Sets the envelope sender address | ||
- `-F`: Sets the sender's full name | ||
- `-N`: Specifies delivery status notifications (NEVER, SUCCESS, FAILURE, DELAY) | ||
- `-v`: Enables verbose mode for detailed output | ||
- `-i`: Ignores single dots on a line | ||
- `-t`: Reads recipients from the message headers (To, Cc, Bcc) | ||
|
||
### Configuration Flags | ||
|
||
These flags can be used to override the configuration file settings: | ||
|
||
- `--config`: Specify an alternate configuration file location | ||
- `--smtp_user`: SMTP username | ||
- `--smtp_password`: SMTP password | ||
- `--smtp_host`: SMTP server hostname | ||
- `--smtp_port`: SMTP server port | ||
- `--smtp_security`: SMTP security (SSL, TLS, or None) | ||
- `--send_from`: Default "From" email address | ||
- `--log_file`: Log file location | ||
- `--log_level`: Log level (error or info) | ||
|
||
## Examples | ||
|
||
Send an email using the configuration file settings: | ||
|
||
``` | ||
echo "Subject: Test Email | ||
This is a test email." | smtplmail [email protected] | ||
``` | ||
|
||
Send an email with a custom sender: | ||
|
||
``` | ||
echo "Subject: Test Email | ||
This is a test email." | smtplmail -f [email protected] [email protected] | ||
``` | ||
|
||
Send an email using recipients from headers: | ||
|
||
``` | ||
echo "To: [email protected] | ||
Cc: [email protected] | ||
Subject: Test Email | ||
This is a test email." | smtplmail -t | ||
``` | ||
|
||
## Logging | ||
|
||
Logs are written to the file specified in the configuration (default: `/var/log/smtplemail/smtplemail.log`). The log level can be set to "error" or "info" in the configuration file or using the `--log_level` flag. | ||
|
||
## Contributing | ||
|
||
Contributions are welcome! Please feel free to submit a Pull Request. | ||
|
||
## License | ||
|
||
[Specify your license here] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module smtplmail | ||
|
||
go 1.21.6 | ||
|
||
require gopkg.in/yaml.v2 v2.4.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= | ||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | ||
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= | ||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= |
Oops, something went wrong.