lokale mit PHP verschickte Mails in AppleMail abrufen

Postfix

  • sudo vi /etc/postfix/main.cf, folgende Zeile ans ende:
virtual_maps = regexp:/etc/postfix/virtual-redirect
  • folgende Zeile: inet_interfaces = 127.0.0.1 auskommentieren
  • folgende Zeile: mail_spool_directory = /var/mail auskommentieren
  • Redirect einrichten: sudo vi /etc/postfix/virtual-redirect
  • folgende Zeile, dabei kampfq mit deinem nutzernamen ersetzen /.+@.+/ kampfq
  • Postfix starten: sudo postfix start

Dovecot

  • Dovcot installieren: brew install dovecot
  • dovecot conf anlegen, kampfq durch deinen Nutzernamen ersetzen: vi /usr/local/etc/dovecot/local.conf

# Listen for localhost
listen = 127.0.0.1

# Use IMAP
protocols = imap

# Set a password
# This is fine for local development, not a proper server.
passdb {
    driver = static
    args = password=SUPERSICHERESPASSWORD
}

# Set the mail location. %u will be substituted with your username.
# The first path is where your other IMAP folders will go,
# the second is where your mail spool is.
# See dovecot/conf.d/10-mail.conf for more information.
mail_location = mbox:/Users/kampfq/Maildir:INBOX=/var/mail/kampfq


# Set the user and group for accessing mail.
# The groupname might be staff, root or admin depending on how
# your computer is set up.
mail_uid = kampfq
mail_gid = staff

# Login user is internally used by login processes. This is the most
# untrusted user in Dovecot system. It shouldn't have access to anything
# at all.
default_login_user = _dovenull

# Internal user is used by unprivileged processes. It should be separate
# from login user, so that login processes can't disturb other processes.
default_internal_user = _dovecot

# Group to enable temporarily for privileged operations. Currently this is
# used only with INBOX when either its initial creation or dotlocking
# fails. Typically this is set to "mail" to give access to /var/mail.
mail_privileged_group = mail
  • !include auth-system.conf.ext auskommentieren in /usr/local/etc/dovecot/conf.d/10-auth.conf

/usr/local/etc/dovecot/conf.d/10-ssl.conf:

  • ssl = no setzen
  • ssl_cert und ssl_key auskommentieren
  • Dovecot starten: sudo brew services start dovecot

PHP anpassen

  • php.ini anpassen: sendmail_path = "sendmail -t -I"
  • Apache neu starten: apachectl -k restart

Mailprogramm einrichten

  • neuer Account
  • IMAP
  • Server: 127.0.0.1
  • Email: dein Nutzername@127.0.0.1
  • User: dein Nutzername in /usr/local/etc/dovecot/local.conf
  • Passwort: Passwort in /usr/local/etc/dovecot/local.conf

Credits

XDEB