| 1 | <?php |
| 2 | /* |
| 3 | * File: imap.php |
| 4 | * Category: config |
| 5 | * Author: M. Goldenbaum |
| 6 | * Created: 24.09.16 22:36 |
| 7 | * Updated: - |
| 8 | * |
| 9 | * Description: |
| 10 | * - |
| 11 | */ |
| 12 | |
| 13 | return [ |
| 14 | |
| 15 | /* |
| 16 | |-------------------------------------------------------------------------- |
| 17 | | Default date format |
| 18 | |-------------------------------------------------------------------------- |
| 19 | | |
| 20 | | The default date format is used to convert any given Carbon::class object into a valid date string. |
| 21 | | These are currently known working formats: "d-M-Y", "d-M-y", "d M y" |
| 22 | | |
| 23 | */ |
| 24 | 'date_format' => 'd-M-Y', |
| 25 | |
| 26 | /* |
| 27 | |-------------------------------------------------------------------------- |
| 28 | | Default account |
| 29 | |-------------------------------------------------------------------------- |
| 30 | | |
| 31 | | The default account identifier. It will be used as default for any missing account parameters. |
| 32 | | If however the default account is missing a parameter the package default will be used. |
| 33 | | Set to 'false' [boolean] to disable this functionality. |
| 34 | | |
| 35 | */ |
| 36 | 'default' => 'default', |
| 37 | |
| 38 | /* |
| 39 | |-------------------------------------------------------------------------- |
| 40 | | Security options |
| 41 | |-------------------------------------------------------------------------- |
| 42 | | |
| 43 | | You can enable or disable certain security features here by setting them to true or false to enable or disable |
| 44 | | them. |
| 45 | | -detect_spoofing: |
| 46 | | Detect spoofing attempts by checking the message sender against the message headers. |
| 47 | | Default TRUE |
| 48 | | -detect_spoofing_exception: |
| 49 | | Throw an exception if a spoofing attempt is detected. |
| 50 | | Default FALSE |
| 51 | | -sanitize_filenames: |
| 52 | | Sanitize attachment filenames by removing any unwanted and potentially dangerous characters. This is not a |
| 53 | | 100% secure solution, but it should help to prevent some common attacks. Please sanitize the filenames |
| 54 | | again if you need a more secure solution. |
| 55 | | Default TRUE |
| 56 | | |
| 57 | */ |
| 58 | 'security' => [ |
| 59 | "detect_spoofing" => true, |
| 60 | "detect_spoofing_exception" => false, |
| 61 | "sanitize_filenames" => true, |
| 62 | ], |
| 63 | |
| 64 | /* |
| 65 | |-------------------------------------------------------------------------- |
| 66 | | Available accounts |
| 67 | |-------------------------------------------------------------------------- |
| 68 | | |
| 69 | | Please list all IMAP accounts which you are planning to use within the |
| 70 | | array below. |
| 71 | | |
| 72 | */ |
| 73 | 'accounts' => [ |
| 74 | |
| 75 | 'default' => [// account identifier |
| 76 | 'host' => 'localhost', |
| 77 | 'port' => 993, |
| 78 | 'protocol' => 'imap', //might also use imap, [pop3 or nntp (untested)] |
| 79 | 'encryption' => 'ssl', // Supported: false, 'ssl', 'tls' |
| 80 | 'validate_cert' => true, |
| 81 | 'username' => '[email protected]', |
| 82 | 'password' => '', |
| 83 | 'authentication' => null, |
| 84 | 'rfc' => 'RFC822', // If you are using iCloud, you might want to set this to 'BODY' |
| 85 | 'proxy' => [ |
| 86 | 'socket' => null, |
| 87 | 'request_fulluri' => false, |
| 88 | 'username' => null, |
| 89 | 'password' => null, |
| 90 | ], |
| 91 | "timeout" => 30, |
| 92 | "extensions" => [] |
| 93 | ], |
| 94 | |
| 95 | /* |
| 96 | 'gmail' => [ // account identifier |
| 97 | 'host' => 'imap.gmail.com', |
| 98 | 'port' => 993, |
| 99 | 'encryption' => 'ssl', |
| 100 | 'validate_cert' => true, |
| 101 | 'username' => '[email protected]', |
| 102 | 'password' => 'PASSWORD', |
| 103 | 'authentication' => 'oauth', |
| 104 | ], |
| 105 | |
| 106 | 'another' => [ // account identifier |
| 107 | 'host' => '', |
| 108 | 'port' => 993, |
| 109 | 'encryption' => false, |
| 110 | 'validate_cert' => true, |
| 111 | 'username' => '', |
| 112 | 'password' => '', |
| 113 | 'authentication' => null, |
| 114 | ] |
| 115 | */ |
| 116 | ], |
| 117 | |
| 118 | /* |
| 119 | |-------------------------------------------------------------------------- |
| 120 | | Available IMAP options |
| 121 | |-------------------------------------------------------------------------- |
| 122 | | |
| 123 | | Available php imap config parameters are listed below |
| 124 | | -Delimiter (optional): |
| 125 | | This option is only used when calling $oClient-> |
| 126 | | You can use any supported char such as ".", "/", (...) |
| 127 | | -Fetch option: |
| 128 | | IMAP::FT_UID - Message marked as read by fetching the body message |
| 129 | | IMAP::FT_PEEK - Fetch the message without setting the "seen" flag |
| 130 | | -Fetch sequence id: |
| 131 | | IMAP::ST_UID - Fetch message components using the message uid |
| 132 | | IMAP::ST_MSGN - Fetch message components using the message number |
| 133 | | -Body download option |
| 134 | | Default TRUE |
| 135 | | -Flag download option |
| 136 | | Default TRUE |
| 137 | | -Soft fail |
| 138 | | Default FALSE - Set to TRUE if you want to ignore certain exception while fetching bulk messages |
| 139 | | -RFC822 |
| 140 | | Default TRUE - Set to FALSE to prevent the usage of \imap_rfc822_parse_headers(). |
| 141 | | See https://github.com/Webklex/php-imap/issues/115 for more information. |
| 142 | | -Debug enable to trace communication traffic |
| 143 | | -UID cache enable the UID cache |
| 144 | | -Fallback date is used if the given message date could not be parsed |
| 145 | | -Boundary regex used to detect message boundaries. If you are having problems with empty messages, missing |
| 146 | | attachments or anything like this. Be advised that it likes to break which causes new problems.. |
| 147 | | -Message key identifier option |
| 148 | | You can choose between the following: |
| 149 | | 'id' - Use the MessageID as array key (default, might cause hickups with yahoo mail) |
| 150 | | 'number' - Use the message number as array key (isn't always unique and can cause some interesting behavior) |
| 151 | | 'list' - Use the message list number as array key (incrementing integer (does not always start at 0 or 1) |
| 152 | | 'uid' - Use the message uid as array key (isn't always unique and can cause some interesting behavior) |
| 153 | | -Fetch order |
| 154 | | 'asc' - Order all messages ascending (probably results in oldest first) |
| 155 | | 'desc' - Order all messages descending (probably results in newest first) |
| 156 | | -Disposition types potentially considered an attachment |
| 157 | | Default ['attachment', 'inline'] |
| 158 | | -Common folders |
| 159 | | Default folder locations and paths assumed if none is provided |
| 160 | | -Open IMAP options: |
| 161 | | DISABLE_AUTHENTICATOR - Disable authentication properties. |
| 162 | | Use 'GSSAPI' if you encounter the following |
| 163 | | error: "Kerberos error: No credentials cache |
| 164 | | file found (try running kinit) (...)" |
| 165 | | or ['GSSAPI','PLAIN'] if you are using outlook mail |
| 166 | | |
| 167 | */ |
| 168 | 'options' => [ |
| 169 | 'delimiter' => '/', |
| 170 | 'fetch' => \Webklex\PHPIMAP\IMAP::FT_PEEK, |
| 171 | 'sequence' => \Webklex\PHPIMAP\IMAP::ST_UID, |
| 172 | 'fetch_body' => true, |
| 173 | 'fetch_flags' => true, |
| 174 | 'soft_fail' => false, |
| 175 | 'rfc822' => true, |
| 176 | 'debug' => false, |
| 177 | 'unescaped_search_dates' => false, |
| 178 | 'uid_cache' => true, |
| 179 | // 'fallback_date' => "01.01.1970 00:00:00", |
| 180 | 'boundary' => '/boundary=(.*?(?=;)|(.*))/i', |
| 181 | 'message_key' => 'list', |
| 182 | 'fetch_order' => 'asc', |
| 183 | 'dispositions' => ['attachment', 'inline'], |
| 184 | 'common_folders' => [ |
| 185 | "root" => "INBOX", |
| 186 | "junk" => "INBOX/Junk", |
| 187 | "draft" => "INBOX/Drafts", |
| 188 | "sent" => "INBOX/Sent", |
| 189 | "trash" => "INBOX/Trash", |
| 190 | ], |
| 191 | 'open' => [ |
| 192 | // 'DISABLE_AUTHENTICATOR' => 'GSSAPI' |
| 193 | ] |
| 194 | ], |
| 195 | |
| 196 | /** |
| 197 | * |-------------------------------------------------------------------------- |
| 198 | * | Available decoding options |
| 199 | * |-------------------------------------------------------------------------- |
| 200 | * | |
| 201 | * | Available php imap config parameters are listed below |
| 202 | * | -options: Decoder options (currently only the message subject and attachment name decoder can be set) |
| 203 | * | 'utf-8' - Uses imap_utf8($string) to decode a string |
| 204 | * | 'mimeheader' - Uses mb_decode_mimeheader($string) to decode a string |
| 205 | * | -decoder: Decoder to be used. Can be replaced by custom decoders if needed. |
| 206 | * | 'header' - HeaderDecoder |
| 207 | * | 'message' - MessageDecoder |
| 208 | * | 'attachment' - AttachmentDecoder |
| 209 | */ |
| 210 | 'decoding' => [ |
| 211 | 'options' => [ |
| 212 | 'header' => 'utf-8', // mimeheader |
| 213 | 'message' => 'utf-8', // mimeheader |
| 214 | 'attachment' => 'utf-8' // mimeheader |
| 215 | ], |
| 216 | 'decoder' => [ |
| 217 | 'header' => \Webklex\PHPIMAP\Decoder\HeaderDecoder::class, |
| 218 | 'message' => \Webklex\PHPIMAP\Decoder\MessageDecoder::class, |
| 219 | 'attachment' => \Webklex\PHPIMAP\Decoder\AttachmentDecoder::class |
| 220 | ] |
| 221 | ], |
| 222 | |
| 223 | /* |
| 224 | |-------------------------------------------------------------------------- |
| 225 | | Available flags |
| 226 | |-------------------------------------------------------------------------- |
| 227 | | |
| 228 | | List all available / supported flags. Set to null to accept all given flags. |
| 229 | */ |
| 230 | 'flags' => ['recent', 'flagged', 'answered', 'deleted', 'seen', 'draft'], |
| 231 | |
| 232 | /* |
| 233 | |-------------------------------------------------------------------------- |
| 234 | | Available events |
| 235 | |-------------------------------------------------------------------------- |
| 236 | | |
| 237 | */ |
| 238 | 'events' => [ |
| 239 | "message" => [ |
| 240 | 'new' => \Webklex\PHPIMAP\Events\MessageNewEvent::class, |
| 241 | 'moved' => \Webklex\PHPIMAP\Events\MessageMovedEvent::class, |
| 242 | 'copied' => \Webklex\PHPIMAP\Events\MessageCopiedEvent::class, |
| 243 | 'deleted' => \Webklex\PHPIMAP\Events\MessageDeletedEvent::class, |
| 244 | 'restored' => \Webklex\PHPIMAP\Events\MessageRestoredEvent::class, |
| 245 | ], |
| 246 | "folder" => [ |
| 247 | 'new' => \Webklex\PHPIMAP\Events\FolderNewEvent::class, |
| 248 | 'moved' => \Webklex\PHPIMAP\Events\FolderMovedEvent::class, |
| 249 | 'deleted' => \Webklex\PHPIMAP\Events\FolderDeletedEvent::class, |
| 250 | ], |
| 251 | "flag" => [ |
| 252 | 'new' => \Webklex\PHPIMAP\Events\FlagNewEvent::class, |
| 253 | 'deleted' => \Webklex\PHPIMAP\Events\FlagDeletedEvent::class, |
| 254 | ], |
| 255 | ], |
| 256 | |
| 257 | /* |
| 258 | |-------------------------------------------------------------------------- |
| 259 | | Available masking options |
| 260 | |-------------------------------------------------------------------------- |
| 261 | | |
| 262 | | By using your own custom masks you can implement your own methods for |
| 263 | | a better and faster access and less code to write. |
| 264 | | |
| 265 | | Checkout the two examples custom_attachment_mask and custom_message_mask |
| 266 | | for a quick start. |
| 267 | | |
| 268 | | The provided masks below are used as the default masks. |
| 269 | */ |
| 270 | 'masks' => [ |
| 271 | 'message' => \Webklex\PHPIMAP\Support\Masks\MessageMask::class, |
| 272 | 'attachment' => \Webklex\PHPIMAP\Support\Masks\AttachmentMask::class |
| 273 | ] |
| 274 | ]; |