modoboa / modoboa-installer

An installer for Modoboa
MIT License
258 stars 135 forks source link

FAILED to send email using MacOS mail client or iPhone Client (brand new installation) #405

Closed berniey closed 2 years ago

berniey commented 2 years ago

Update 2022-03-05

Also tested on MacOS client and failed to send as well. Setup using step 7 as described in https://www.linuxbabe.com/mail-server/email-server-ubuntu-18-04-modoboa.

Impacted versions

Note: Modoboa is installed using install script. Below is the version I've used

commit d272118d6a9e948f02f206fa95d228731fe7a6e2 (HEAD -> master, origin/master, origin/HEAD)
Merge: 04b38cf 7f87c25
Author: Antoine Nguyen <tonio@ngyn.org>
Date:   Thu Nov 4 10:26:45 2021 +0100

    Merge branch 'master' of github.com:modoboa/modoboa-installer

Steps to reproduce

  1. Use same sender (from) and recipient (to)
  2. Setup account on both iphone (SSL, Password Authentication, IMAP Path Prefix -> "/", Server port 993) and webmail
  3. Successfully connected to modoboa and managed to get all email from the account, but FAILED to send email
  4. Modoboa web client working normally as expected (i.e. can receive and send text based email)

Full trace using --debug option or current behavior

Sending email from iphone

Feb 16 23:32:14 ip-172-30-2-158 postfix/submission/smtpd[2739]: connect from S0106e0dbd1498133.cg.<replaced>.net[xx.51.xx.49]

==> /var/log/mail.log <==
Feb 16 23:32:15 ip-172-30-2-158 postfix/submission/smtpd[2739]: Anonymous TLS connection established from s0106e0dbd1498133.cg.<replaced>.net[xx.51.xx.49]: TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)

==> /var/log/mail.log <==
Feb 16 23:32:16 ip-172-30-2-158 postfix/submission/smtpd[2739]: warning: problem talking to server 127.0.0.1:9999: Success

==> /var/log/mail.log <==
Feb 16 23:32:16 ip-172-30-2-158 postfix/submission/smtpd[2739]: NOQUEUE: reject: RCPT from S0106e0dbd1498133.cg.<replaced>.net[xx.51.xx.49]: 451 4.3.5 <---@gmail.com>: Recipient address rejected: Server configuration problem; from=<me@++++.org> to=<---@gmail.com> proto=ESMTP helo=<[10.0.0.226]>

Sending email from Modoboa webapp

Feb 16 23:26:37 ip-172-30-2-158 postfix/smtpd[2021]: connect from localhost[127.0.0.1]

==> /var/log/mail.log <==
Feb 16 23:26:37 ip-172-30-2-158 postfix/smtpd[2021]: 764F21778D1: client=localhost[127.0.0.1], orig_client=localhost[127.0.0.1]

==> /var/log/mail.log <==
Feb 16 23:26:37 ip-172-30-2-158 postfix/cleanup[2022]: 764F21778D1: message-id=<164505399229.24910.610722968915154058@ip-172-30-2-158.ec2.internal>

==> /var/log/mail.log <==
Feb 16 23:26:37 ip-172-30-2-158 opendkim[25500]: 764F21778D1: DKIM-Signature field added (s=modoboa, d=++++.org)

==> /var/log/mail.log <==
Feb 16 23:26:37 ip-172-30-2-158 postfix/qmgr[28781]: 764F21778D1: from=<me@++++.org>, size=1061, nrcpt=1 (queue active)

==> /var/log/mail.log <==
Feb 16 23:26:37 ip-172-30-2-158 postfix/smtpd[2021]: disconnect from localhost[127.0.0.1] ehlo=1 xforward=1 mail=1 rcpt=1 data=1 quit=1 commands=6

==> /var/log/mail.log <==
Feb 16 23:26:37 ip-172-30-2-158 postfix/smtp[2023]: connect to gmail-smtp-in.l.google.com[2607:f8b0:400d:c09::1a]:25: Network is unreachable

==> /var/log/mail.log <==
Feb 16 23:26:37 ip-172-30-2-158 amavis[22809]: (22809-12) Passed CLEAN {RelayedOpenRelay}, [127.0.0.1]:40344 <me@++++.org> -> <---@gmail.com>, Message-ID: <164505399229.24910.610722968915154058@ip-172-30-2-158.ec2.internal>, mail_id: 3hlaPHixuNOL, Hits: -1, size: 569, queued_as: 764F21778D1, 5053 ms

==> /var/log/mail.log <==
Feb 16 23:26:37 ip-172-30-2-158 postfix/smtpd[2012]: proxy-accept: END-OF-MESSAGE: 250 2.0.0 from MTA(smtp:[127.0.0.1]:10025): 250 2.0.0 Ok: queued as 764F21778D1; from=<me@++++.org> to=<---@gmail.com> proto=ESMTP helo=<ip-172-30-2-158.ec2.internal>
Feb 16 23:26:37 ip-172-30-2-158 postfix/smtpd[2012]: disconnect from localhost[127.0.0.1] ehlo=1 mail=1 rcpt=1 data=1 quit=1 commands=5

==> /var/log/mail.log <==
Feb 16 23:26:37 ip-172-30-2-158 postfix/smtp[2023]: Trusted TLS connection established to gmail-smtp-in.l.google.com[209.85.144.27]:25: TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)

==> /var/log/mail.log <==
Feb 16 23:26:38 ip-172-30-2-158 postfix/smtp[2023]: 764F21778D1: to=<---@gmail.com>, relay=gmail-smtp-in.l.google.com[209.85.144.27]:25, delay=0.93, delays=0.14/0.02/0.16/0.62, dsn=2.0.0, status=sent (250 2.0.0 OK  1645053998 hr10si9693076qvb.139 - gsmtp)

==> /var/log/mail.log <==
Feb 16 23:26:38 ip-172-30-2-158 postfix/qmgr[28781]: 764F21778D1: removed

Expected behavior

berniey commented 2 years ago

Is this related to https://github.com/modoboa/modoboa/issues/2200 ?

berniey commented 2 years ago

So it turns out it was issue with modoba.

This is from the /var/log/supervisor/policyd-stdout---supervisor-eMbCvP.log:

Task exception was never retrieved
future: <Task finished coro=<run_at() done, defined at /srv/modoboa/env/lib/python3.6/site-packages/modoboa/policyd/core.py:64> exception=AttributeError("module 'aioredis' has no attribute 'create_redis_pool'",)>
Traceback (most recent call last):
  File "/srv/modoboa/env/lib/python3.6/site-packages/modoboa/policyd/core.py", line 67, in run_at
    return await coro(*args)
  File "/srv/modoboa/env/lib/python3.6/site-packages/modoboa/policyd/core.py", line 258, in reset_counters
    rclient = await aioredis.create_redis_pool(settings.REDIS_URL)
AttributeError: module 'aioredis' has no attribute 'create_redis_pool'

The issue has to do with modoboa code incompatibility with aioredis version 2.0.1. My solution is to downgrade aioredis to version 1.3.1 (see below). After that I can send email from both captioned mail client.

Run the following commands to downgrade aioredis:

source /srv/modoboa/env/bin/activate
pip uninstall aioredis
pip install aioredis==1.3.1
deactivate
systemctl restart supervisor.service 
stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.