@@ -26,6 +26,26 @@ Add the service provider to the providers array in `config/app.php`.
26
26
];
27
27
```
28
28
29
+ If you are planning to use a single account, you might want to add the following to
30
+ your .env file.
31
+
32
+ ```
33
+ IMAP_HOST=somehost.com
34
+ IMAP_PORT=993
35
+ IMAP_ENCRYPTION=ssl
36
+ IMAP_VALIDATE_CERT=true
37
+
38
+ IMAP_PASSWORD=secret
39
+ ```
40
+
41
+ The following encryption methods are supported:
42
+ ```
43
+ false - Disable encryption
44
+ ssl - Use SSL
45
+ tls - Use TLS
46
+
47
+ ```
48
+
29
49
## Publishing
30
50
31
51
You can publish everything at once
@@ -40,10 +60,6 @@ or you can publish groups individually.
40
60
php artisan vendor:publish --provider="Webklex\IMAP\Providers\LaravelServiceProvider" --tag="config"
41
61
```
42
62
43
- ## Usage
44
-
45
- [ ...]
46
-
47
63
Access the IMAP Client by its Facade (Webklex\IMAP\Facades\Client).
48
64
Therefor you might want to add an alias to the aliases array within the ` config/app.php ` file.
49
65
@@ -53,6 +69,50 @@ Therefor you might want to add an alias to the aliases array within the `config/
53
69
];
54
70
```
55
71
72
+ ## Usage
73
+
74
+ This library is designed to handle the native php imap functions more easily and to be
75
+ able to integrate this package within your current laravel installation.
76
+
77
+ Here is a basic example, which will echo out all Mails within all imap folders
78
+ and will move every message into INBOX.read. Please be aware that this should not ben
79
+ tested in real live but it gives an impression on how things work.
80
+
81
+ ``` php
82
+ use Webklex\IMAP\Client;
83
+
84
+ //Connect to the IMAP Server
85
+ $oClient = new Client([
86
+ 'host' => 'somehost.com',
87
+ 'port' => 993,
88
+ 'encryption' => 'ssl',
89
+ 'validate_cert' => true,
90
+ 'username' => 'username',
91
+ 'password' => 'password',
92
+ ]);
93
+ $oClient->connect();
94
+
95
+ //Get all Mailboxes
96
+ $aMailboxes = $oClient->getFolders();
97
+
98
+ //Loop through every Mailbox
99
+ foreach($aMailboxes as $oMailboxes){
100
+
101
+ //Get all Messages of the current Mailbox
102
+ foreach($oMailbox->getMessages() as $oMessage){
103
+ echo $oMessage->subject.'<br />';
104
+ echo $oMessage->getHTMLBody(true);
105
+
106
+ //Move the current Message to 'INBOX.read'
107
+ if($oMessage->moveToFolder('INBOX.read') == true){
108
+ echo 'Message has ben moved';
109
+ }else{
110
+ echo 'Message could not be moved';
111
+ }
112
+ }
113
+ }
114
+ ```
115
+
56
116
## Change log
57
117
58
118
Please see [ CHANGELOG] ( CHANGELOG.md ) for more information what has changed recently.
0 commit comments