ONLYOFFICE / Docker-CommunityServer

Collaborative system for managing documents, projects, customer relations and emails in one place
MIT License
465 stars 174 forks source link

Having Headaches sending and receiving emails. #214

Open aaronouthier opened 3 weeks ago

aaronouthier commented 3 weeks ago

Hello!

First off, despite setting the smart host info in the mail server settings, My OnlyOffice self-hosted install insists on trying to connect direct to the recipient email server directly. I am using my ISP's Internet connection, and am not allowed to relay mail from there. I am specifically paying a company to allow mail relaying through them, but I can't get OnlyOffice to actually use it.

Secondly, I use a separate mail proxy to filter junk mail and malware on both incoming and outgoing messages. Filter sits between my Internet Connection and OnlyOffice-CS box. All incoming mail is being sent to junk folder.

Carazyda commented 3 weeks ago

Hello @aaronouthier Please clarify at what stage you are getting the error? Emails are not sent/downloaded to the onlyoffice mail server? is there a problem with third party email services such as gmail?

Also indicate what version you have and what host OS? Have you looked at the error logs?

aaronouthier commented 3 weeks ago

The issue is two-fold:

1: When sending to a gmail account, for example, I get a bounce message saying OnlyOffice couldn't connect to gmail's mail server. It shouldn't be trying to connect directly. Mail should be relayed via my set smarthost. A sample of the bounce message when attempting to send to an icloud email address:

Action: failed Status: 4.4.1 Diagnostic-Code: X-Postfix; connect to mx01.mail.icloud.com[17.57.154.33]:25: Connection refused

2: Incoming mail seems to be subject to spam filtering, which is flagging everything coming in as Spam, except it own bounce messages/delivery reports. By the time OnlyOffice receives any email, it has already been filtered for both spam and viruses. I don't want any additional filtering to be done.

Host is Ubuntu 22.04 running Docker. I am managing the stack via Docker-compose.yml . Entire docker-communityserver repo was cloned with git prior to first use.

Community server version 12.6.0.1900 Document Server version 8.0.1.1 Mail Server version 1.6.75

aaronouthier commented 3 weeks ago

Logs, as per docker compose logs onlyoffice-mail-server:

onlyoffice-mail-server | [ INFO ] Checking configuration file: /usr/src/iRedMail/config ... [FOUND] onlyoffice-mail-server | [ INFO ] Import installation process status from file: /usr/src/iRedMail/runtime/install.status. onlyoffice-mail-server | Waiting for external MySql response onlyoffice-mail-server | onlyoffice-mail-server | onlyoffice-mail-server | onlyoffice-mail-server | onlyoffice-mail-server | ******************************************************************** onlyoffice-mail-server | * Start iRedMail Configurations onlyoffice-mail-server | ******************************************************************** onlyoffice-mail-server | [ INFO ] Create required system accounts: vmail, iredapd. onlyoffice-mail-server | [ INFO ] Configure Apache web server and PHP. onlyoffice-mail-server | [ INFO ] Configure PHP. onlyoffice-mail-server | [ INFO ] Configure MySQL database server. onlyoffice-mail-server | [ INFO ] Configure Postfix (Message Transfer Agent). onlyoffice-mail-server | [ INFO ] Configure Cluebringer (postfix policy server). onlyoffice-mail-server | [ INFO ] Configure Dovecot (pop3/imap/managesieve server). onlyoffice-mail-server | [ INFO ] Configure ClamAV (anti-virus toolkit). onlyoffice-mail-server | [ INFO ] Configure Amavisd-new (interface between MTA and content checkers). onlyoffice-mail-server | [ INFO ] Configure SpamAssassin (content-based spam filter). onlyoffice-mail-server | ERROR 1053 (08S01) at line 136772 in file: '/usr/src/iRedMail/samples/spamassassin/bayes_seen': Server shutdown in progress onlyoffice-mail-server | [ INFO ] Configure OpenDkim. onlyoffice-mail-server | ERROR 2003 (HY000): Can't connect to MySQL server on 'onlyoffice-mysql-server' (111) onlyoffice-mail-server | [ INFO ] Configure Fail2ban (authentication failure monitor). onlyoffice-mail-server | [ INFO ] Configure Server API. onlyoffice-mail-server | ERROR 2003 (HY000): Can't connect to MySQL server on 'onlyoffice-mysql-server' (111) onlyoffice-mail-server | rake aborted! onlyoffice-mail-server | Mysql2::Error: Lost connection to MySQL server at 'reading initial communication packet', system error: 111 onlyoffice-mail-server | /usr/local/rvm/gems/ruby-2.3.3/gems/mysql2-0.3.21/lib/mysql2/client.rb:70:inconnect' onlyoffice-mail-server | /usr/local/rvm/gems/ruby-2.3.3/gems/mysql2-0.3.21/lib/mysql2/client.rb:70:in initialize' onlyoffice-mail-server | /usr/local/rvm/gems/ruby-2.3.3/gems/activerecord-3.2.22.5/lib/active_record/connection_adapters/mysql2_adapter.rb:16:innew' onlyoffice-mail-server | /usr/local/rvm/gems/ruby-2.3.3/gems/activerecord-3.2.22.5/lib/active_record/connection_adapters/mysql2_adapter.rb:16:in mysql2_connection' onlyoffice-mail-server | /usr/local/rvm/gems/ruby-2.3.3/gems/activerecord-3.2.22.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:315:innew_connection' onlyoffice-mail-server | /usr/local/rvm/gems/ruby-2.3.3/gems/activerecord-3.2.22.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:325:in checkout_new_connection' onlyoffice-mail-server | /usr/local/rvm/gems/ruby-2.3.3/gems/activerecord-3.2.22.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:247:inblock (2 levels) in checkout' onlyoffice-mail-server | /usr/local/rvm/gems/ruby-2.3.3/gems/activerecord-3.2.22.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:in loop' onlyoffice-mail-server | /usr/local/rvm/gems/ruby-2.3.3/gems/activerecord-3.2.22.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:inblock in checkout' onlyoffice-mail-server | /usr/local/rvm/gems/ruby-2.3.3/gems/activerecord-3.2.22.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:239:in checkout' onlyoffice-mail-server | /usr/local/rvm/gems/ruby-2.3.3/gems/activerecord-3.2.22.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:102:inblock in connection' onlyoffice-mail-server | /usr/local/rvm/gems/ruby-2.3.3/gems/activerecord-3.2.22.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:101:in connection' onlyoffice-mail-server | /usr/local/rvm/gems/ruby-2.3.3/gems/activerecord-3.2.22.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:410:inretrieve_connection' onlyoffice-mail-server | /usr/local/rvm/gems/ruby-2.3.3/gems/activerecord-3.2.22.5/lib/active_record/connection_adapters/abstract/connection_specification.rb:171:in retrieve_connection' onlyoffice-mail-server | /usr/local/rvm/gems/ruby-2.3.3/gems/activerecord-3.2.22.5/lib/active_record/connection_adapters/abstract/connection_specification.rb:145:inconnection' onlyoffice-mail-server | /usr/local/rvm/gems/ruby-2.3.3/gems/activerecord-3.2.22.5/lib/active_record/model_schema.rb:229:in columns' onlyoffice-mail-server | /usr/local/rvm/gems/ruby-2.3.3/gems/schema_plus-1.5.3/lib/schema_plus/active_record/base.rb:23:incolumns_with_schema_plus' onlyoffice-mail-server | /usr/local/rvm/gems/ruby-2.3.3/gems/activerecord-3.2.22.5/lib/active_record/model_schema.rb:244:in column_defaults' onlyoffice-mail-server | /usr/local/rvm/gems/ruby-2.3.3/gems/activerecord-3.2.22.5/lib/active_record/base.rb:482:ininitialize' onlyoffice-mail-server | /usr/local/rvm/gems/ruby-2.3.3/gems/activerecord-3.2.22.5/lib/active_record/persistence.rb:44:in new' onlyoffice-mail-server | /usr/local/rvm/gems/ruby-2.3.3/gems/activerecord-3.2.22.5/lib/active_record/persistence.rb:44:increate' onlyoffice-mail-server | /var/www/html/mailserver_api-2.0.1/Rakefile:8:in block (2 levels) in <top (required)>' onlyoffice-mail-server | Tasks: TOP => api_key:generate onlyoffice-mail-server | (See full trace by running task with --trace) onlyoffice-mail-server | [ INFO ] Configure SpamTrainer. onlyoffice-mail-server | [ INFO ] Configure Awstats (logfile analyzer for mail and web server). onlyoffice-mail-server | onlyoffice-mail-server | ************************************************************************* onlyoffice-mail-server | * iRedMail-0.9.2 installation and configuration complete. onlyoffice-mail-server | ************************************************************************* onlyoffice-mail-server | onlyoffice-mail-server | [ INFO ] Disable SELinux in /etc/selinux/config. onlyoffice-mail-server | [ INFO ] Removing package(s): sendmail onlyoffice-mail-server | Loaded plugins: fastestmirror, ovl onlyoffice-mail-server | Setting up Remove Process onlyoffice-mail-server | Resolving Dependencies onlyoffice-mail-server | --> Running transaction check onlyoffice-mail-server | ---> Package sendmail.x86_64 0:8.14.4-9.el6_8.1 will be erased onlyoffice-mail-server | --> Processing Dependency: sendmail = 8.14.4-9.el6_8.1 for package: sendmail-devel-8.14.4-9.el6_8.1.x86_64 onlyoffice-mail-server | --> Running transaction check onlyoffice-mail-server | ---> Package sendmail-devel.x86_64 0:8.14.4-9.el6_8.1 will be erased onlyoffice-mail-server | --> Finished Dependency Resolution onlyoffice-mail-server | onlyoffice-mail-server | Dependencies Resolved onlyoffice-mail-server | onlyoffice-mail-server | ================================================================================ onlyoffice-mail-server | Package Arch Version Repository Size onlyoffice-mail-server | ================================================================================ onlyoffice-mail-server | Removing: onlyoffice-mail-server | sendmail x86_64 8.14.4-9.el6_8.1 @base 1.5 M onlyoffice-mail-server | Removing for dependencies: onlyoffice-mail-server | sendmail-devel x86_64 8.14.4-9.el6_8.1 @base 254 k onlyoffice-mail-server | onlyoffice-mail-server | Transaction Summary onlyoffice-mail-server | ================================================================================ onlyoffice-mail-server | Remove 2 Package(s) onlyoffice-mail-server | onlyoffice-mail-server | Installed size: 1.8 M onlyoffice-mail-server | Downloading Packages: onlyoffice-mail-server | Running rpm_check_debug onlyoffice-mail-server | Running Transaction Test onlyoffice-mail-server | Transaction Test Succeeded onlyoffice-mail-server | Running Transaction onlyoffice-mail-server | Warning: RPMDB altered outside of yum. Erasing : sendmail-devel-8.14.4-9.el6_8.1.x86_64 1/2 Erasing : sendmail-8.14.4-9.el6_8.1.x86_64 2/2 onlyoffice-mail-server | warning: erase unlink of /var/log/mail/statistics failed: No such file or directory onlyoffice-mail-server | warning: erase unlink of /var/log/mail failed: No such file or directory Verifying : sendmail-devel-8.14.4-9.el6_8.1.x86_64 1/2 Verifying : sendmail-8.14.4-9.el6_8.1.x86_64 2/2 onlyoffice-mail-server | onlyoffice-mail-server | Removed: onlyoffice-mail-server | sendmail.x86_64 0:8.14.4-9.el6_8.1 onlyoffice-mail-server | onlyoffice-mail-server | Dependency Removed: onlyoffice-mail-server | sendmail-devel.x86_64 0:8.14.4-9.el6_8.1 onlyoffice-mail-server | onlyoffice-mail-server | Complete! onlyoffice-mail-server | [ INFO ] Copy firewall sample rules: /etc/sysconfig/iptables. onlyoffice-mail-server | [ INFO ] Restarting firewall ... onlyoffice-mail-server | [ INFO ] Copy MySQL sample file: /etc/my.cnf. onlyoffice-mail-server | [ INFO ] Enable SSL support for MySQL server. onlyoffice-mail-server | ******************************************************************** onlyoffice-mail-server | * First mail account credential: onlyoffice-mail-server | * onlyoffice-mail-server | * o Username: postmaster@mail.aaronouthier.com onlyoffice-mail-server | * o Password: ODEyNGJjNmQ0 onlyoffice-mail-server | * onlyoffice-mail-server | * onlyoffice-mail-server | ******************************************************************** onlyoffice-mail-server | * Congratulations, mail server setup completed successfully. Please onlyoffice-mail-server | * read below file for more information: onlyoffice-mail-server | * onlyoffice-mail-server | * - /usr/src/iRedMail/iRedMail.tips onlyoffice-mail-server | * onlyoffice-mail-server | * And it's sent to your mail account postmaster@mail.aaronouthier.com. onlyoffice-mail-server | * onlyoffice-mail-server | ********************* WARNING ************************************** onlyoffice-mail-server | Waiting for external MySql response onlyoffice-mail-server | [ INFO ] Configure MySQL database server. onlyoffice-mail-server | Starting crond: [ OK ] onlyoffice-mail-server | Starting Dovecot Imap: [ OK ] onlyoffice-mail-server | Starting system logger: [ OK ] onlyoffice-mail-server | Starting amavisd: [ OK ] onlyoffice-mail-server | onlyoffice-mail-server | Starting postfix: [ OK ] onlyoffice-mail-server | Starting cbpolicyd: [ OK ] onlyoffice-mail-server | Starting Clam AntiVirus Daemon: LibClamAV Warning: ************************************************** onlyoffice-mail-server | LibClamAV Warning: *** The virus database is older than 7 days! *** onlyoffice-mail-server | LibClamAV Warning: *** Please update it as soon as possible. *** onlyoffice-mail-server | LibClamAV Warning: ************************************************** onlyoffice-mail-server | [ OK ] onlyoffice-mail-server | Starting clamd.amavisd: LibClamAV Warning: ************************************************** onlyoffice-mail-server | LibClamAV Warning: *** The virus database is older than 7 days! *** onlyoffice-mail-server | LibClamAV Warning: *** Please update it as soon as possible. *** onlyoffice-mail-server | LibClamAV Warning: ************************************************** onlyoffice-mail-server | [ OK ] onlyoffice-mail-server | Starting httpd: [ OK ] onlyoffice-mail-server | Starting OpenDKIM Milter: [ OK ] onlyoffice-mail-server | Starting spamd: [ OK ] onlyoffice-mail-server | Starting fail2ban: [ OK ] onlyoffice-mail-server | Starting server

Carazyda commented 3 weeks ago

Do you connect your domain on the mail server tab and create a mailbox on this domain? and are you trying to send and receive mail through it? Right?

What if you just connect your gmail account in the mail module? Also check the errors in the mail-aggregator.errors.log and mail-imapsync.errors.log logs.

aaronouthier commented 3 weeks ago

Do you connect your domain on the mail server tab and create a mailbox on this domain? and are you trying to send and receive mail through it? Right?

Correct.

What if you just connect your gmail account in the mail module? Also check the errors in the mail-aggregator.errors.log and mail-imapsync.errors.log logs.

I'm not sure how to use a non-domain account with OnlyOffice. Didn't know I even could.

As for those log files, I didn't see any such logs, neither on the docker host, nor in the docker environment. I looked in both the current folder, and /var/log/ in both cases. Only file which contained both 'mail' and 'log' was called 'mailog', locatex in /var/ log inside the Docker container. It contains too much sensitive data to post publicly.

Carazyda commented 2 weeks ago

Yes, you can connect any mail account in mail module->account management. But it only downloads email without imap sync.

You can find the logs in mail folder on community_log volume, if you dont change it in https://github.com/ONLYOFFICE/Docker-CommunityServer/blob/master/docker-compose.workspace.yml#L60. Or you can find it in the communityserver container in /var/log/onlyoffice/mail/.

aaronouthier commented 2 weeks ago

Ok. I'd rather not mess with "t it only downloads email without imap sync".

docker exec -it onlyoffice-community-server /bin/bash -c "cat /var/log/onlyoffice/mail/mail-aggregator-errors.log ; exit" | tee mail-aggregator-errors-log.txt
cat: /var/log/onlyoffice/mail/mail-aggregator-errors.log: No such file or directory

There IS, however, a mail-aggregator.log file. It is 10.5 MB in size though. I also have a mail-log file from the onlyoffice-mail-server container. I need to load each onto my laptop and attempt to redact my email address from each, as it appears hundreds of times.

Carazyda commented 2 weeks ago

What about mail-imapsync.errors.log?

You can post most recurring errors here without providing your email address.

aaronouthier commented 2 weeks ago

piping the previously named files through "grep -i error" yields no output.

docker exec -it onlyoffice-community-server /bin/bash -c "cat /var/log/onlyoffice/mail/mail-imapsync.errors.log"
2024-05-29 12:28:53,917 ERROR [66] ASC.Mail.User_96f1e689-dcdf-11ee-b0dc-0242ac120003 - CheckRedis method: Object reference not set to an instance of an object.. 
2024-05-29 12:39:49,827 ERROR [82] ASC.Mail.User_96f1e689-dcdf-11ee-b0dc-0242ac120003 - CheckRedis method: Object reference not set to an instance of an object..