bokysan / docker-postfix

Multi architecture simple SMTP server (postfix null relay) host for your Docker and Kubernetes containers. Based on Debian/Ubuntu/Alpine.
MIT License
548 stars 149 forks source link

Can't send mail - all recipients were rejected #209

Closed AlissonRS closed 3 months ago

AlissonRS commented 3 months ago

I have a working setup using Google Workspace SMTP Relay, I'm testing locally and added my own IP address into Google Console, I managed to send emails just fine with my primary email address.

I added a secondary domain to my Google Workspace, and added an alternate email address to my user, so now I have:

My docker-compose looks like this:

  postfix:
    image: boky/postfix:latest
    container_name: postfix
    restart: always
    environment:
      - RELAYHOST=smtp-relay.gmail.com:587
      - ALLOWED_SENDER_DOMAINS=mysecondarydomain.com myprimarydomain.com
    ports:
      - "1587:587"
      - "25:25"

When I try sending email from my secondary email address, I get this error:

Error: Can't send mail - all recipients were rejected: 554 5.7.1 my-test-recipient@gmail.com: Recipient address rejected: Access denied

(my-test-recipient is a valid test email I own, and I have successfully received emails using my primary email for sending)

I also tried changing "Allowed Senders" to "Only addresses in my domain" in the SMTP Relay settings in Workspace, just in case.

image

Both my domains (primary and secondary) have DKIM, DMARC and SPF enabled, though that should be handled by Google.

I can send emails from Gmail manually just fine.

Do I need any extra setup to support an alternate domain? Or perhaps Google itself doesn't support using alternate domains with SMTP Relay (though it works fine from Gmail, from there I can use my alternate domain as a sender).

bokysan commented 3 months ago

Hi,

thank you for your report. While I would love to help, this is outside the scope of the image and I am currently preoccupied.

To help you diagnose the issue:

As always, internet is your friend. Search around for how to configure postfix. If everything else fails, try finding a local postfix guru.

I am sorry I cannot be of more help.