Mails don't show up for contacts or companies
I've one issue with email syncing to contacts in my podman installation of twenty in version v1.1.1 - which I installed from scratch, so no migration issue.
The system seems to run flawlessly:
- health status is green for every service,
- active sync shows "1"
- metadata version is set correctly and
- no errors in the container logs
I enabled IMAP and was able to add an imap mail account to one of the users. The mail account shows synced after a while and in the logs I get the correct number of mails. But:
- Mails don't get assigned to their respective contacts (email-addresses match)
- no contacts get created when sending a mail or receiving a mail (option in mail accounts is set to "sent and received")
What have I done to debug:
- increased the log level to log all, incl. debug (no issues seen)
- checked the database
- flushed the cache
- tested the webhook functionality to ensure the worker container runs without issues
- redeployed from scratch
How to get the emails to show up for my contacts or companies?
Thanks in advance for your support.
Best, Stefan
39 Replies
Follow up of my question (as post was too long):
environment of the worker container:
/app/packages/twenty-server $ env
EMAIL_SMTP_PORT=465
NODE_VERSION=22.17.0
MESSAGING_PROVIDER_IMAP_ENABLED=True
YARN_VERSION=1.22.22
IS_IMAP_SMTP_CALDAV_ENABLED=True
REACT_APP_SERVER_BASE_URL=
EMAIL_SYSTEM_ADDRESS=no-reply@mydomain.net
SHLVL=1
HOME=/home/node
DISABLE_CRON_JOBS_REGISTRATION=true
PG_DATABASE_URL=postgres://myuser:password@postgres-pod:5432/db_twenty
IS_CONFIG_VARIABLES_IN_DB_ENABLED=true
container=podman
EMAIL_SMTP_password=secret-password
STORAGE_TYPE=local
EMAIL_SMTP_NO_TLS=False
TERM=xterm
APP_SECRET=very-secret-secret
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
EMAIL_FROM_ADDRESS=no-reply@mydomain.net
DISABLE_DB_MIGRATIONS=true
EMAIL_FROM_NAME=mycompany
EMAIL_DRIVER=smtp
SERVER_URL=https://crm.mydomain.net
PWD=/app/packages/twenty-server
EMAIL_SMTP_HOST=mail.mydomain.net
EMAIL_SMTP_USER=smtp-user
REDIS_URL=redis://redis-pod:6379
APP_VERSION=v1.1.1
Hello, that's an interesting case 🤔
Could you check if mails are in database and also if there are messageParticipants? It can be done via API as well
Just to explain all message related things:
- messageChannel is connected account which is available in Settings > Emails
- messageThread contains all messages in thread
- messageParticipant is a user(s) with whom thread has been created
- message is just a message
- messageChannelMessageAssociations maps messages from account's thread to Twenty's messageThreads
Hi Bob, thanks for the detailed information. I checked for messages and messageParticipants, both are empty.
My assumption here was, that my mails are not added because there are no participants they could be assigned to.
In the meanwhile I also already opened an issue in the projects Github (#13397). Neo told me to wait for the next tagged release of Twenty as there will be a lot of changes for the IMAP module.
Hey @swin indeed a lot of fixes also regarding the impa connection about to be released in 1.2.0 during the day
That sounds promising 🙂 Thanks for sharing this information
My pleasure, will let you know here ! ( if I remember to 😛 )
@Prastoin , @bob , now it's getting weird:
I updated to Twenty v1.2.1 now and afterwards recreated the mail connections. Still no mails or contacts showed up.
The I stopped the containers, deleted the contents of the data directory and dropped the contents of the "dbtwenty" postgres db.
When starting the twenty server container it did not automatically start creating the schemas and contents. So I logged in to the container and issued "yarn database:init:prod". Afterwards the schemas had been available as "core" and "workspace[id]". To be on the save side I restarted the server container and after the initialization was finished I started the worker container.
I'm now able to log in and work with the CRM. Two issues:
1st issue: invitations are not sent anymore via mail ("Error: Mail command failed: 503 5.5.1 You must authenticate first"). This worked like a charm in v1.1.1) and the settings are the same as before the recreation of the database (the setup is done via ansible, so completely reproducable).
2nd issue (same as with v1.1.1): I also was able to create the IMAP, SMTP and Caldav connection. Again the logs confirm that the fetching of the mails works and show the correct number of messages. But again no messages are being added to the respective database tables.
Any idea?
Thanks in advance for your support,
Best, Stefan
Hey Stefan,
Could you please have a look to this when you have some free time @Félix?
I am here because we hare facing the same issue. Is there something we can do?
Unknown User•2mo ago
Message Not Public
Sign In & Join Server To View
That sound good, thanks a lot.
Unknown User•2mo ago
Message Not Public
Sign In & Join Server To View
Perfect, thanks. I will wait for the next release then - which will come soon hopefully 🙂 (probably as hotfix? 😉 )
Unknown User•2mo ago
Message Not Public
Sign In & Join Server To View
@Félix , @NEO
fyi:
Not yet officially released, but I already tried with a fresh install of version 1.3.2. (I needed to start off with setting up 1.2.0 first - as there is currently a bug in the latest version (#13676 with PR already created for fixing this) that registration of new users doesn't work. Afterwards I directly migrated to 1.3.2).
Current behaviour:
- Contacts from caldav calendar events are being created, appointments are available in the calendar view
- Still no mails available in respective database tables.
- Error when trying to open health status for worker (Queue-Informationen sind nicht verfügbar, weil der Worker ausgefallen ist) means: queue information not available as worker is not running/accessible.
Unknown User•2mo ago
Message Not Public
Sign In & Join Server To View
I didn't find anything about "WorkerHealthIndicator" in the logs, even with debug_mode=true.
I restarted the container, please find attached the respective logs. Hopefully it's halfways helpful.
On the failed health status I found there is already an open issue on github: https://github.com/twentyhq/twenty/issues/13701
GitHub
[Error] Worker is not working "Queue information is not available b...
Bug Description In the Admin Panel → Health Status, I can see the worker entry, but when I click it, nothing is displayed. The breadcrumb ends with undefined, and the page shows: “Queue information...
@swin this issue you mentioned is fixed on main in
https://github.com/twentyhq/twenty/pull/13619
were u getting the same error?
GitHub
[Admin Panel] fix invalid uuid issue on health status by ehconitin ...
Health status queries are failing at the moment - regression was introduced in 01f2551
health status ids are not uuids, we use params to fetch them on the frontend.
But maybe @FelixMalfait and @abd...
That leaves me with one open point - that's the not created messages/mails :/
did you run the cron jobs?
As I'm using the docker images, the cron jobs should be triggered automatically within the container, right? And the checking for mails is also logged every 5 minutes.
Cron job registration is disabled, skipping... -- your logs show the auto registeration is not enabled
here
If I recall it correctly, I set it up according to the documentation - where the DISABLE_CRON_JOBS_REGISTRATION=false is for the twenty-server container and DISABLE_CRON_JOBS_REGISTRATION=true for the worker. Did I get that wrong?
ah thats workers logs, which means thats the correct behavior 🙂 sorry mb
Unfortunatelly, I needed to reopen my issue (https://github.com/twentyhq/twenty/issues/13884) Would be great if you could check, as I'm currently running out of options for further debugging :/
Thanks
GitHub
Mails not syncing for IMAP account · Issue #13884 · twentyhq/twenty
Bug Description Reopening: #13397 Clean installation of Twenty CRM (self hosted docker, image version v1.3.1) After adding a mail account (IMAP, SMTP, CALDAV), the twenty worker logs show that the ...
Unknown User•4w ago
Message Not Public
Sign In & Join Server To View
Can't seem to reproduce this, tried just now with a gmail
@swin Your worker logs indicate it only found 2 messages, could you confirm that?
Are you self hosting the email server or using a cloud hosted solution like hetzner email?
@NEO , good point, there are indeed more than two mails in my INBOX and also in the "Sent Items" folder. And there is also no other folder containing only two messages.
I'm hosting my own mailserver (Stalwart, version v0.13.1).
What I find interesting about your logs is, that the INSERT sql statement is part of the logs. Is this missing for me, as the INSERT isn't triggered or is there a trick to get the SQL statements logged? As per my understanding, I turned on all possible log levels already?
I checked the imap server capabilities:
Just in case you need it 😉
That complicates the debugging process a lot, are you aware of any managed/cloud hosted versions of Stalwart?
@swin
@NEO , no, I'm not. What prerequisits do you need? I can create an account for you for debugging, if you want/need it. I can also configure settings as per your needs.
That'd be pretty great, an empty new account is all I need, we can move this part of conversation to DMs
Kindly tell me how I can reach you directly. In the meanwhile I start creating an account.
Sent you a friend request, could you please accept so I can DM you
@NEO , thanks a lot for your intensive support.
I just installed the latest released version 1.4.0 from scratch, now the initial sync works, finally I find new contacts and companies added for sent and received mails - and also the mails (from inbox and also sent items) are visible for the contacts
However, during further testing I sent a mail to a new contact, but this one doesn't get created. In the workers logs I find:
[Nest] 29 - 08/21/2025, 5:02:00 PM WARN [ImapGetMessagesService] Message <5B66211A-23CE-4B07-96E8-465CFCECF222@mydomain.net> could not be parsed - likely not found in current folders.
When adding a second account I saw, only one out of twenty of the mails got parsed and added to the messages db table. All others also ended up with a log record like the one seen above.
Any ideas?
DMed
Interesting, the IMAP feature is quite new and we might have missed some edge cases. Mailbox standard is poorly normalized and all vendors are implementing standards as they want :p could you please open an issue on Github and we will work on that
We are getting there one, compatibility is not too bad for now