SMTP/POP3
alpine
tmail:
image: adite/tmail
ports:
- "25:25"
- "110:110"
volumes:
- mail:/tmp/mail
environment:
- MAIL_NAME = mydomain.com
- MAIL_PATH = /tmp/mail
- MAIL_USER = admin
- MAIL_PASS = admin
restart: always
MAIL_OPTS = --user = USER_NAME = USER_PASSWORD
$ sudo docker-compose up -d
$ cat hello_mail.py
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import smtplib
server = smtplib.SMTP('localhost', 25)
server.set_debuglevel(1)
server.sendmail('admin@localhost', '[email protected]', 'Hi~! admin!?')
server.quit()
$ python ./hello_mail.py
$ cat read_mail.py
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import poplib
client = poplib.POP3('localhost', 110)
client.user('[email protected]')
client.pass_('admin')
num_messages = len(client.list()[1])
for i in range(num_messages):
for j in client.retr(i+1)[1]:
print(j)
for i in range(num_messages):
client.dele(i)
$ python ./hello.py
Content type
Image
Digest
Size
39.9 MB
Last updated
almost 11 years ago
docker pull adite/tmail