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

Sending an email using Basic SMTP server #1

Open
qlands opened this issue Sep 28, 2019 · 6 comments
Open

Sending an email using Basic SMTP server #1

qlands opened this issue Sep 28, 2019 · 6 comments

Comments

@qlands
Copy link

qlands commented Sep 28, 2019

I'm running the Basic SMTP server and trying to send an email using Python + SMTPLib but I always get "Connection refused" Do you have any examples on how to send an email with the Basic SMTP server?

@khromov
Copy link

khromov commented Jan 7, 2020

@qlands Can you check whether the IP address you are trying to send the email from is whitelisted according to RELAY_NETS? (See at the bottom of https://github.com/BytemarkHosting/docker-smtp#environment-variables )

@gonzalodiaz
Copy link

What should be the RELAY_NETS to send emails to gmail? Thanks

@khromov
Copy link

khromov commented Jul 8, 2020

@gonzalodiaz RELAY_NETS is not the addresses you send to, it's the ip ranges that the SMTP server will accept mail from, and any machines you run in docker needs to run within those ip ranges. You can find the default ranges here: https://github.com/BytemarkHosting/docker-smtp#environment-variables

If your ranges are not listed, you need to add your docker ip ranges via RELAY_NETS.

@coreyog
Copy link

coreyog commented Aug 4, 2020

I tried setting RELAY_NETS to 0.0.0.0/0, 127.0.0.1/32, and <my internal IP>/32 and I can't get any program from outside the container to connect.

I tried getting a shell inside the container, apt install netcat, nc localhost 25 and did all the HELO'ing myself and successfully got an email to send. I feel like something is up with how RELAY_NETS works.

@khromov
Copy link

khromov commented Aug 5, 2020

@coreyog Did you try netcat from another docker container in the same docker-compose.yml? (I'm assuming you're using docker-compose with multiple containers of which the smtp one is one of them).

If you have a different setup, please share it.

@spdbel
Copy link

spdbel commented Nov 7, 2022

use ports:
- 127.0.0.1:25:25

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

5 participants