Skip to content

Gmail message import: body text empty for messages from certain sender hosts (Yandex, SES, Android stock mail, custom SMTP) #19879

@orcunbaslak

Description

@orcunbaslak

Summary

On a Gmail-connected workspace, inbound messages from certain sender hosts are imported with empty message.text while metadata (subject, participants, thread) is stored correctly. Contact (Person) detail pages consequently appear to "hide" those emails — they are in the DB but render blank/empty.

Environment

  • Twenty version: 1.23.1
  • Docker image: twentycrm/twenty:latest (built 2026-04-17)
  • Self-hosted via Docker Compose (server + worker + postgres:16 + redis)
  • Messaging provider: Gmail (MESSAGING_PROVIDER_GMAIL_ENABLED=true)
  • 3 connected Gmail accounts, all syncStatus=ACTIVE, messageFolderImportPolicy=ALL_FOLDERS, visibility=SHARE_EVERYTHING

Reproduction

A person has 4 messages in the thread — 2 inbound (contact → us), 2 outbound (us → contact). All 4 rows exist in message, with correct messageParticipant rows linked to personId. However:

  • 2 outbound messages (composed in Gmail web) → LENGTH(text) = 717 and 1437
  • 2 inbound messages (sent from contact's Yandex mailbox) → LENGTH(text) = 0

Result: on the contact page, only the 2 outbound messages appear to display meaningful content.

Distribution across the mailbox

Out of 11,958 imported messages, 801 (~6.7%) have empty bodies. Grouped by headerMessageId host:

Sender host (Message-ID domain) Empty body With body
mail.yandex.com.tr 24 0
mail.yandex.com 12 0
us-east-2.amazonses.com 44 0
email.android.com (Android stock mail) (multiple) 0
Some *.prod.outlook.com 7+ 0
mail.gmail.com 164 5061
custom SMTP (own domain) 132 2862

Hosts that send via non-Gmail infrastructure have a very high or 100% body-empty rate. Gmail-native messages mostly succeed (a small fraction fail too, likely HTML-only with no text/plain part).

Expected behavior

message.text should be populated with the message body (plain text extracted from the Gmail API payload parts), regardless of the sending MTA/client. When no text/plain part is present, the importer should fall back to converting text/html → plain text.

Actual behavior

message.text is stored as empty string for many inbound messages, predominantly from non-Gmail origins.

Related

Secondary observation

In this workspace, all 11,958 messages have direction='INCOMING', zero 'OUTGOING' — even messages clearly sent from a connected account (FROM = ownaccount@ourdomain, TO = external contact). The direction-assignment step of the Gmail importer appears to never produce OUTGOING. Possibly related, possibly a second bug — flagging for triage.

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions