Skip to content

hyper-prog/restgomail

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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"
    }
}

About

HTTP-REST Mail gateway written in Go

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published