greenmail-mail-test / greenmail

Official master for the Greenmail project
http://greenmail-mail-test.github.io/greenmail/
Apache License 2.0
628 stars 180 forks source link

Nonexisting mailboxes, Undeliverable and bounce emails #556

Open sel-carlitos opened 1 year ago

sel-carlitos commented 1 year ago

The main page states:

Dgreenmail.auth.disabled = Disables user authentication check, so that any password works. Useful if you do not want to preconfigure user/passwords. GreenMail automatically creates non-existent users.

I am using the docker standalone in docker compose under the services section like so:

  mail:
    container_name: mail
    image: greenmail/standalone:latest
    expose:
      - "25:25"     # SMTP
      - "110:110"   # POP3
      - "143:143"   # IMAP
      - "465:465"   # SMTPS SSL
      - "587:587"   # SMTPS TLS
      - "993:993"   # IMAPS
      - "995:995"   # POP3S
    ports:
      - "8880:8080" # API
    environment:
      - 'GREENMAIL_OPTS=-Dgreenmail.setup.smtp
                        -Dgreenmail.setup.imap
                        -Dgreenmail.setup.api
                        -Dgreenmail.verbose
                        -Dgreenmail.users=user1:user1@local.dev,user2:user2@local.dev
                        -Dgreenmail.users.login=email
                        -Dgreenmail.hostname=0.0.0.0'

So far so good! But I have a scenario where I need to disable the automatic creation of non-existing users. The reasoning is that user1@local.dev is sending an email to a non-existing account somename@not-deliverable.com

Ideally, user1@local.dev would receive a bounce email stating that the email doesn't exist.

Is there a way to set/mock this up?

Thanks!

marcelmay commented 1 year ago

Hi @sel-carlitos ,

unfortunately this feature does not exist out-of-the-box.

You could implement it via a custom message delivery handler, but you want it for the standalone mode.

This feature ('configuring bouncing for a email address') would be a nice extension.