# list config
su - mailman -s /bin/bash -c "mailman3 conf"

# add members
echo "gnunux@gnunux.info" > /tmp/test
su - mailman -s /bin/bash -c "mailman3 addmembers /tmp/test list1@lists.gnunux.info"

# try to send mail
from mailman.mta.connection import Connection, as_SecureMode
from lazr.config import as_boolean
from mailman.config import config
from importlib_resources import read_text  
from zope.configuration import xmlconfig

xmlconfig.string(read_text('mailman.config', 'configure.zcml'))
config.load('/etc/mailman.cfg')

connection = Connection(
     config.mta.smtp_host, int(config.mta.smtp_port), 0,
     config.mta.smtp_user, config.mta.smtp_pass,
     as_SecureMode(config.mta.smtp_secure_mode),
     as_boolean(config.mta.smtp_verify_cert),
     as_boolean(config.mta.smtp_verify_hostname))



connection.sendmail('gnunux@gnunux.info', ['gnunux@gnunux.info'], """\
From: gnunux@gnunux.info
To: gnunux@gnunux.info
Subject: test

""")

# admin password for postorius

echo "ACCOUNT_EMAIL_VERIFICATION = 'none'" >> /etc/mailman3.d/postorius.py
systemctl restart postorius
export MAILMAN_WEB_CONFIG=/usr/share/postorius/m_postorius/settings.py
/usr/share/postorius/manage.py changepassword admin@gnunux.info 

# debug postorius

echo "DEBUG=True" >> /etc/mailman3.d/postorius.py
systemctl restart postorius

