presseportale/config/imap.php
Kevin Adametz f9c97ccf2f mail: Rückläufer aus dem Bounce-Postfach lesen (Roadmap 1b.6, Schritt 3)
webklex/laravel-imap als Transport, eigener DSN-Parser nach RFC 3464 auf
der rohen Nachricht: Final-Recipient, Action, Status, Diagnostic-Code und
unser X-Pk-Ref aus der Original-Nachricht. Maßgeblich ist Action —
Zustellbestätigungen sperren niemanden, Freitext-Rückläufer wandern nach
Unparsed vor einen Menschen, Abwesenheitsnotizen nach Ignored.
mail:fetch-bounces alle zehn Minuten; ohne Konto tut es nichts.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-15 13:55:30 +00:00

196 lines
6.7 KiB
PHP

<?php
use Webklex\IMAP\Events\FlagDeletedEvent;
use Webklex\IMAP\Events\FlagNewEvent;
use Webklex\IMAP\Events\FolderDeletedEvent;
use Webklex\IMAP\Events\FolderMovedEvent;
use Webklex\IMAP\Events\FolderNewEvent;
use Webklex\IMAP\Events\MessageCopiedEvent;
use Webklex\IMAP\Events\MessageDeletedEvent;
use Webklex\IMAP\Events\MessageMovedEvent;
use Webklex\IMAP\Events\MessageNewEvent;
use Webklex\IMAP\Events\MessageRestoredEvent;
use Webklex\PHPIMAP\Decoder\AttachmentDecoder;
use Webklex\PHPIMAP\Decoder\HeaderDecoder;
use Webklex\PHPIMAP\Decoder\MessageDecoder;
use Webklex\PHPIMAP\IMAP;
use Webklex\PHPIMAP\Support\Masks\AttachmentMask;
use Webklex\PHPIMAP\Support\Masks\MessageMask;
/*
* File: imap.php
* Category: config
* Author: M. Goldenbaum
* Created: 24.09.16 22:36
* Updated: -
*
* Description:
* -
*/
return [
/*
|--------------------------------------------------------------------------
| IMAP default account
|--------------------------------------------------------------------------
|
| The default account identifier. It will be used as default for any missing account parameters.
| If however the default account is missing a parameter the package default will be used.
| Set to 'false' [boolean] to disable this functionality.
|
*/
'default' => 'bounces',
/*
|--------------------------------------------------------------------------
| Default date format
|--------------------------------------------------------------------------
|
| The default date format is used to convert any given Carbon::class object into a valid date string.
| These are currently known working formats: "d-M-Y", "d-M-y", "d M y"
|
*/
'date_format' => 'd-M-Y',
/*
|--------------------------------------------------------------------------
| Available IMAP accounts
|--------------------------------------------------------------------------
|
| Please list all IMAP accounts which you are planning to use within the
| array below.
|
*/
/*
| `bounces`: das Postfach hinter MAIL_RETURN_PATH (bounce@pressekonto.com),
| gelesen von `mail:fetch-bounces` (Roadmap 1b.6). Ohne Host/Benutzer tut
| der Befehl nichts — so läuft der Scheduler auch ohne Postfach durch.
*/
'accounts' => [
'bounces' => [
'host' => env('BOUNCE_IMAP_HOST'),
'port' => (int) env('BOUNCE_IMAP_PORT', 993),
'protocol' => 'imap',
'encryption' => env('BOUNCE_IMAP_ENCRYPTION', 'ssl'),
'validate_cert' => (bool) env('BOUNCE_IMAP_VALIDATE_CERT', true),
'username' => env('BOUNCE_IMAP_USERNAME'),
'password' => env('BOUNCE_IMAP_PASSWORD'),
'authentication' => null,
'proxy' => [
'socket' => null,
'request_fulluri' => false,
'username' => null,
'password' => null,
],
'timeout' => 30,
'extensions' => [],
],
],
'options' => [
'delimiter' => '/',
'fetch' => IMAP::FT_PEEK,
'sequence' => IMAP::ST_UID,
'fetch_body' => true,
'fetch_flags' => true,
'soft_fail' => false,
'rfc822' => true,
'debug' => false,
'uid_cache' => true,
// 'fallback_date' => "01.01.1970 00:00:00",
'boundary' => '/boundary=(.*?(?=;)|(.*))/i',
'message_key' => 'list',
'fetch_order' => 'asc',
'dispositions' => ['attachment', 'inline'],
'common_folders' => [
'root' => 'INBOX',
'junk' => 'INBOX/Junk',
'draft' => 'INBOX/Drafts',
'sent' => 'INBOX/Sent',
'trash' => 'INBOX/Trash',
],
'open' => [
// 'DISABLE_AUTHENTICATOR' => 'GSSAPI'
],
],
/**
* |--------------------------------------------------------------------------
* | Available decoding options
* |--------------------------------------------------------------------------
* |
* | Available php imap config parameters are listed below
* | -options: Decoder options (currently only the message subject and attachment name decoder can be set)
* | 'utf-8' - Uses imap_utf8($string) to decode a string
* | 'mimeheader' - Uses mb_decode_mimeheader($string) to decode a string
* | -decoder: Decoder to be used. Can be replaced by custom decoders if needed.
* | 'header' - HeaderDecoder
* | 'message' - MessageDecoder
* | 'attachment' - AttachmentDecoder
*/
'decoding' => [
'options' => [
'header' => 'utf-8', // mimeheader
'message' => 'utf-8', // mimeheader
'attachment' => 'utf-8', // mimeheader
],
'decoder' => [
'header' => HeaderDecoder::class,
'message' => MessageDecoder::class,
'attachment' => AttachmentDecoder::class,
],
],
/*
|--------------------------------------------------------------------------
| Available flags
|--------------------------------------------------------------------------
|
| List all available / supported flags. Set to null to accept all given flags.
*/
'flags' => ['recent', 'flagged', 'answered', 'deleted', 'seen', 'draft'],
/*
|--------------------------------------------------------------------------
| Available events
|--------------------------------------------------------------------------
|
*/
'events' => [
'message' => [
'new' => MessageNewEvent::class,
'moved' => MessageMovedEvent::class,
'copied' => MessageCopiedEvent::class,
'deleted' => MessageDeletedEvent::class,
'restored' => MessageRestoredEvent::class,
],
'folder' => [
'new' => FolderNewEvent::class,
'moved' => FolderMovedEvent::class,
'deleted' => FolderDeletedEvent::class,
],
'flag' => [
'new' => FlagNewEvent::class,
'deleted' => FlagDeletedEvent::class,
],
],
/*
|--------------------------------------------------------------------------
| Available masking options
|--------------------------------------------------------------------------
|
| By using your own custom masks you can implement your own methods for
| a better and faster access and less code to write.
|
| Checkout the two examples custom_attachment_mask and custom_message_mask
| for a quick start.
|
| The provided masks below are used as the default masks.
*/
'masks' => [
'message' => MessageMask::class,
'attachment' => AttachmentMask::class,
],
];