restgomail

command module
v0.0.0-...-47abaf3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 4, 2022 License: GPL-2.0 Imports: 15 Imported by: 0

README

RestGoMail logo

RestGoMail - HTTP-REST Mail gateway in Go

RestGoMail is a small daemon/container which able to receive HTML e-mail forward requests as HTTP POST in a JSON data, queue the requests, and sends the specified mails to a SMTP server according to the settings.

Docker images

Available a docker container with a compiled restgomail daemon: Docker hub:

Downloadable (pullable) image name:

hyperprog/restgomail

Check the docker-compose.yml file under the EXAMPLES directory to learn how to configure it.

Config file sample (JSON)

You need to give a JSON file as a command line argument to specify SMTP host and port, the authentications, allowed client certificates and so on...

{
    "restgomail": {
        "httpsListenPort": "443",
        "smtpHost": "smtp.gmail.com",
        "smtpPort": "587",
        "smtpAuthRequired": true,
        "smtpAuthPassword": "gmailpasswordsample",
        "smtpAllowedFromAddressOnly": "sampleuser@gmail.com",
        "tlsKeyFile": "restgomail.key",
        "tlsCertFile": "restgomail.crt",
        "allowOnlyKnownCertificates": true,
        "knownCertificates": {
            "clientOneContainer": "@one_client.crt",
            "clientTwoContainer": "MIdjr6RfjfuESwekjEDffg..."
        },
        "waitSecondsAfterSmtpReq": 10,
        "debugMode": false
    }
}

E-mail send request sample (JSON)

This is a sample JSON passed as HTTP-POST request to the 443 port (configured above)

{
    "sendmail": {
        "from": "sampleuser@gmail.com",
        "to": "tomyfriend@postmail.com",
        "subject": "This is a test message",
        "bodyhtml": "Probably <i>I can say</i> this thing is <h1>WORK'S FLAWLESS!</h1>!"
    }
}

You can encode subject and bodyhtml in base64 if the data contains special characters

{
    "sendmail": {
        "from": "sampleuser@gmail.com",
        "to": "tomyfriend@postmail.com",
        "subject": "VGVzdCBmcm9tIFBIUA==",
        "subjectEncoding": "base64",
        "bodyhtml": "VGhpcyBpcyByZWNlaXZlZCB0aHJvdWdoIDxoMT5SZXN0R29NYWlsPC9oMT4=",
        "bodyhtmlEncoding": "base64"
    }
}

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL