Skip to content

Emails sent through custom SMTP provider are missing the "To" header #12365

Closed

Description

@michalPazderka

👟 Reproduction steps

Description

Emails sent using Appwrite Messaging with a custom SMTP provider appear to be delivered successfully, but the received email does not contain or display a proper To recipient field in email clients such as Gmail.

I found another user on the Appwrite Discord with the same issue. They were also using a custom SMTP provider and were not able to find a workaround.

Reproduction steps

  1. Configure Appwrite Messaging with a custom SMTP provider.
  2. Create an email message using the Appwrite Server SDK.
  3. Send the email to a user or target using Messaging.createEmail().
  4. Open the received email in Gmail or another email client.
  5. Check the visible email headers / recipient information.

👍 Expected behavior

The delivered email should include a proper To header, and email clients should display the recipient normally.

For example:

From: Forumek [email protected]
To: Recipient Name [email protected]

or at least:

To: [email protected]

Image

👎 Actual Behavior

The email is delivered successfully, but the recipient field is missing or not displayed properly in email clients.

In Gmail, only the sender is shown, and the usual To / to me / recipient information is missing from the email header preview/details.

Image

🎲 Appwrite version

Different version (specify in environment)

💻 Operating system

Linux

🧱 Your Environment

We are using appwrite 1.9.0 selfhosted, it runs in docker compose.

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

Activity

  1. added
    product / messaging
    product / storage
    sdk / cli
    on May 21, 2026
  2. DEATHGOD89 commented on May 23, 2026

    @DEATHGOD89

    I'd like to work on this issue.

  3. mdsayeem commented on May 27, 2026

    @mdsayeem

    I'd like to work on this issue.

  4. vaguul commented on Jun 1, 2026

    @vaguul

    Not a maintainer, but I found one implementation detail that seems relevant here.

    In src/Appwrite/Platform/Workers/Messaging.php, buildEmailMessage() has this SMTP-specific branch:

    // For SMTP, move all recipients to BCC and use default recipient in TO field
    if ($provider->getAttribute('provider') === 'smtp') {
        foreach ($to as $recipient) {
            $bcc[] = ['email' => $recipient];
        }
        $to = [];
    }

    So for custom SMTP providers, Appwrite appears to intentionally clear the normal To list and move recipients to BCC. That would explain Gmail not showing a visible To recipient, even though delivery succeeds.

    Two checks that would make this issue easier to confirm:

    1. open "Show original" in Gmail and verify whether the raw MIME has no To: header but has the recipient in Bcc/envelope handling
    2. compare the same message through a non-SMTP provider, if available, to see whether the visible To header returns

    If the current behavior is intentional for privacy/bulk-send reasons, maybe the fix is documentation or an SMTP provider option like "show recipients in To". If it is not intentional, the likely area is that SMTP branch rather than the SDK call itself.

  5. Omvrit commented on Jun 15, 2026

    @Omvrit

    Hey, I would like to work upon it issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    product / messagingproduct / storagesdk / cli

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions