Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't get it to work #1

Open
rdeangel opened this issue Feb 24, 2024 · 0 comments
Open

can't get it to work #1

rdeangel opened this issue Feb 24, 2024 · 0 comments

Comments

@rdeangel
Copy link

rdeangel commented Feb 24, 2024

Hi,
I'm interested in this project, but I've tried it in a docker container and can't get it to work, I'm definitely doing something wrong.
Basically what I want to do is my smtp.gmail.com as smtp server by having an internal smtp relay with username and password that relays emails to the gmail smtp.

I have already this working with docker container image "ixdotai/smtp:latest", but that one has no way to configure authentication and just relays messages via plain smtp. I'd like to have TLS working towards the client as well but for now I'm trying to get this working as plainly as possible and it's not.

Thanks for your help

Here is what I've been testing with:

---
services:
  smtp-relay:
    image: ghcr.io/scheiblingco/smtp-relay:0.8.1
    container_name: go-smtp-relay
    volumes:
      - /srv/docker/go-smtp-relay/config.json:/config.json
      - /srv/docker/go-smtp-relay/credentials.json:/credentials.json
    network_mode: bridge
    ports:
      - 2525:2525
    restart: unless-stopped

I also have a credentials.json file that the container can see as it stops complaining about credentials.json not being found

{
    "all": {
        "password": "abc123",
        "allowedDomains": []
    },
    "specific": {
        "password": "123abc",
        "allowedDomains": ["gmail.com"]
    }
}

and I similarly I also have config.json

{
    "server": {
        // Hostname for the server
        "host": "thiscotainer.domain.example",

        // Port to listen on for regular/StartTLS
        "listen": 2525,

        // Enable separate SMTPS listener
        "smtps": false,

        // Listen port for SMTPS
        "listenSmtps": ":4650",

        // Enable STARTTLS (Requires tlsCert and tlsKey)
        "startTls": false,

        // Path to TLS Certificate
        "tlsCert": "tls.crt",

        // Path to TLS Private Key
        "tlsKey": "tls.key",

        // Allow users with insecure connections (no SSL/TLS/StartTLS)
        "allowInsecure": true,

        // Timeout for read/write operations
        "readTimeout": 10,
        "writeTimeout": 10,

        // Maximum number of recipients per message
        "maxRecipients": 100,

        // Maximum message size in MB
        "maxMessageSizeMb": 30

        }
    },
    // Remote SMTP Server Configuration
    "remote": {
        // Hostname
        "host": "smtp.gmail.com",

        // Port
        "port": 587,

        // Enable StartTLS
        "startTls": true,

        // Credentials
        "username": "username@gmail.com",
        "password": "password",

        // Use PLAIN authentication
        "authPlain": false,

        // Use LOGIN authentication
        "authLogin": false
    }
}

when I try to send an email with swaks I can see the connection is refused:

swaks --to email@gmail.com -s thiscotainer.domain.example:2525 --body "test body" --header "Subject: test subject" 
    === Trying thiscotainer.domain.example:2525...
    *** Error connecting to thiscotainer.domain.example:2525:
    ***     IO::Socket::INET6: connect: Connection refused

When I start the container I can see in the logs the following:

2024/02/23 09:11:30 Starting server at :0

which makes me think it's not starting on port 2525 as it should.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant