Web-SMTP Relay is a simple Go application that receives email details via an HTTP POST request and relays the email through an SMTP server. It includes basic authentication and configurable settings.
Clone the repository:
git clone https://github.com/sctg-development/web-smtp-relay.git
cd web-smtp-relay
Build the application:
go build -o web-smtp
The application can be configured using a YAML file, environment variables, and command-line flags.
users:
admin: $2a$10$XOPbrlUPQdwdJUpSrIF6X.LbE14qsMmKGhM1A8W9iqDuy0Bx8KzWq
smtp:
host: smtp.example.com
port: 587
username: your_username
password: your_password
port: 8080
WEB_SMTP_CONFIG_FILE: Path to the configuration fileWEB_SMTP_PORT: Port to listen on-c: Path to the configuration file-p: Port to listen onStart the server:
./web-smtp
Send a POST request to http://localhost:8080/send with the following JSON body:
{
"subject": "Test Subject",
"body": "This is a test email",
"destinations": ["[email protected]"]
}
Include Basic Authentication headers with your request.
The project includes a Dockerfile and GitHub Actions workflow for building and pushing a multi-architecture Docker image.
To run the application using Docker:
docker run -p 8080:8080 -v /path/to/your/config.yaml:/app/config.yaml sctg/web-smtp-relay:latest
This project includes a Helm chart for easy deployment to Kubernetes clusters. The chart creates a Deployment, Service, and ConfigMap for the Web-SMTP Relay application.
Clone the repository or download the Helm chart files.
Navigate to the chart directory:
cd web-smtp-relay
Install the chart with the release name my-web-smtp-relay:
helm install my-web-smtp-relay .
You can customize the chart by modifying the values.yaml file or by passing values on the command line.
Edit the values.yaml file to change default values. For example:
replicaCount: 2
image:
repository: sctg/web-smtp-relay
tag: "1.0.0"
config:
users:
admin: "$2a$10$XOPbrlUPQdwdJUpSrIF6X.LbE14qsMmKGhM1A8W9iqDuy0Bx8KzWq"
newuser: "$2a$10$newuserhashhere"
smtp:
host: smtp.mycompany.com
port: 587
username: myuser
password: mypassword
port: 8080
ingress:
enabled: true
host: web-smtp-relay.mycompany.com
annotations: {}
clusterIssuer: "cert-manager"
You can override values when installing or upgrading the chart:
helm install my-web-smtp-relay . \
--set replicaCount=3 \
--set config.smtp.host=smtp.newhost.com \
--set config.smtp.username=newuser \
--set config.smtp.password=newpassword
| Parameter | Description | Default |
|---|---|---|
replicaCount | Number of replicas for the deployment | 1 |
image.repository | Docker image repository | yourdockerhubusername/web-smtp-relay |
image.tag | Docker image tag | "latest" |
image.pullPolicy | Image pull policy | IfNotPresent |
service.type | Kubernetes service type | ClusterIP |
service.port | Kubernetes service port | 8080 |
config.users | Map of username to bcrypt hashed passwords | See values.yaml |
config.smtp.host | SMTP server hostname | smtp.example.com |
config.smtp.port | SMTP server port | 587 |
config.smtp.username | SMTP username | your_username |
config.smtp.password | SMTP password | your_password |
config.port | Application listening port | 8080 |
resources | CPU/Memory resource requests/limits | See values.yaml |
To update the chart with new values:
helm upgrade my-web-smtp-relay . --reuse-values --set config.smtp.host=smtp.newhost.com
To uninstall/delete the my-web-smtp-relay deployment:
helm uninstall my-web-smtp-relay
For production use, it's recommended to use Kubernetes Secrets for sensitive information like SMTP credentials and user passwords. You can create a secret separately and reference it in the Helm chart. This example uses ConfigMap for simplicity, but for real-world scenarios, consider using Secrets for better security.
This project is licensed under the GNU Affero General Public License v3.0 (AGPLv3).
For the full license text, see the LICENSE file in the project repository or visit GNU AGPL v3.0.
Contributions are welcome! Please feel free to submit a Pull Request.
git checkout -b feature/AmazingFeature)git commit -m 'Add some AmazingFeature')git push origin feature/AmazingFeature)If you encounter any problems or have any questions, please open an issue in the GitHub repository.
Content type
Image
Digest
sha256:1b436a97c…
Size
63 MB
Last updated
about 2 years ago
docker pull sctg/web-smtp-relay