|
19 | 19 | |
20 | 20 | MIME-Version: 1.0 |
21 | 21 | Content-Type: text/plain; charset="UTF-8" |
22 | | - |
| 22 | +
|
23 | 23 | Hello World |
24 | 24 | EOT; |
25 | 25 |
|
|
47 | 47 | MIME-Version: 1.0 |
48 | 48 | Content-Type: multipart/alternative; |
49 | 49 | boundary="----BOUNDARY-ID----" |
50 | | - |
| 50 | +
|
51 | 51 | ------BOUNDARY-ID---- |
52 | 52 | Content-Type: text/plain; charset="UTF-8" |
53 | | - |
| 53 | +
|
54 | 54 | Hello Plain |
55 | | - |
| 55 | +
|
56 | 56 | ------BOUNDARY-ID---- |
57 | 57 | Content-Type: text/html; charset="UTF-8" |
58 | | - |
| 58 | +
|
59 | 59 | <html><body><p>Hello <strong>HTML</strong></p></body></html> |
60 | 60 | ------BOUNDARY-ID------ |
61 | 61 | EOT; |
|
77 | 77 | MIME-Version: 1.0 |
78 | 78 | Content-Type: multipart/mixed; |
79 | 79 | boundary="----BOUNDARY-ID----" |
80 | | - |
| 80 | +
|
81 | 81 | ------BOUNDARY-ID---- |
82 | 82 | Content-Type: text/plain; charset="UTF-8" |
83 | | - |
| 83 | +
|
84 | 84 | Hello with Attachment |
85 | | - |
| 85 | +
|
86 | 86 | ------BOUNDARY-ID---- |
87 | 87 | Content-Type: application/pdf; name="file.pdf" |
88 | 88 | Content-Disposition: attachment; filename="file.pdf" |
89 | 89 | Content-Transfer-Encoding: base64 |
90 | | - |
| 90 | +
|
91 | 91 | JVBERi0xLjUKJeLjz9MKMyAwIG9iago8PC9MZW5ndGggNCAgIC9GaWx0ZXIvQXNjaWlIYXgg |
92 | 92 | ICAgPj5zdHJlYW0Kc3R1ZmYKZW5kc3RyZWFtCmVuZG9iajAK |
93 | 93 | ------BOUNDARY-ID------ |
|
114 | 114 | Subject: No Attachments |
115 | 115 | Date: Wed, 19 Feb 2025 12:34:56 -0500 |
116 | 116 | Content-Type: text/plain; charset="UTF-8" |
117 | | - |
| 117 | +
|
118 | 118 | Just a plain text email without attachments. |
119 | 119 | EOT; |
120 | 120 |
|
|
132 | 132 | Subject: In-Reply-To Check |
133 | 133 | Date: Wed, 19 Feb 2025 12:34:56 -0500 |
134 | 134 | Content-Type: text/plain; charset="UTF-8" |
135 | | - |
| 135 | +
|
136 | 136 | Check the in-reply-to header |
137 | 137 | EOT; |
138 | 138 |
|
|
149 | 149 | Subject: Stringable Test |
150 | 150 | Date: Wed, 19 Feb 2025 12:34:56 -0500 |
151 | 151 | Content-Type: text/plain; charset="UTF-8" |
152 | | - |
| 152 | +
|
153 | 153 | Testing __toString |
154 | 154 | EOT; |
155 | 155 |
|
|
165 | 165 | Subject: Test Email With Inline Image |
166 | 166 | MIME-Version: 1.0 |
167 | 167 | Content-Type: multipart/related; boundary="BOUNDARY_STRING" |
168 | | - |
| 168 | +
|
169 | 169 | --BOUNDARY_STRING |
170 | 170 | Content-Type: text/html; charset=UTF-8 |
171 | | - |
| 171 | +
|
172 | 172 | <html> |
173 | 173 | <body> |
174 | 174 | <p>This is a test email with an inline image:</p> |
175 | 175 | <img src="cid:inline-image-id" alt="Inline Image" /> |
176 | 176 | </body> |
177 | 177 | </html> |
178 | | - |
| 178 | +
|
179 | 179 | --BOUNDARY_STRING |
180 | 180 | Content-Type: image/png; name="inline_image.png" |
181 | 181 | Content-Transfer-Encoding: base64 |
182 | 182 | Content-ID: <inline-image-id> |
183 | 183 | Content-Disposition: inline; filename="inline_image.png" |
184 | | - |
| 184 | +
|
185 | 185 | iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8 |
186 | 186 | z8BQDwABAgEA0xzY2QAAAABJRU5ErkJggg== |
187 | | - |
| 187 | +
|
188 | 188 | --BOUNDARY_STRING-- |
189 | 189 | EOT; |
190 | 190 |
|
|
197 | 197 | expect($attachments[0]->contentId())->toBe('inline-image-id'); |
198 | 198 | expect($attachments[0]->filename())->toBe('inline_image.png'); |
199 | 199 | }); |
| 200 | + |
| 201 | +test('it can determine if two messages are the same', function () { |
| 202 | + $contents1 = <<<'EOT' |
| 203 | + From: "John Doe" <[email protected]> |
| 204 | + Subject: Test Subject |
| 205 | + Date: Wed, 19 Feb 2025 12:34:56 -0500 |
| 206 | + Content-Type: text/plain; charset="UTF-8" |
| 207 | +
|
| 208 | + Test content |
| 209 | + EOT; |
| 210 | + |
| 211 | + $contents2 = <<<'EOT' |
| 212 | + From: "John Doe" <[email protected]> |
| 213 | + Subject: Test Subject |
| 214 | + Date: Wed, 19 Feb 2025 12:34:56 -0500 |
| 215 | + Content-Type: text/plain; charset="UTF-8" |
| 216 | +
|
| 217 | + Test content |
| 218 | + EOT; |
| 219 | + |
| 220 | + $contents3 = <<<'EOT' |
| 221 | + From: "John Doe" <[email protected]> |
| 222 | + Subject: Different Subject |
| 223 | + Date: Wed, 19 Feb 2025 12:34:56 -0500 |
| 224 | + Content-Type: text/plain; charset="UTF-8" |
| 225 | +
|
| 226 | + Different content |
| 227 | + EOT; |
| 228 | + |
| 229 | + $message1 = new FileMessage($contents1); |
| 230 | + $message2 = new FileMessage($contents2); |
| 231 | + $message3 = new FileMessage($contents3); |
| 232 | + |
| 233 | + // Same content |
| 234 | + expect($message1->is($message2))->toBeTrue(); |
| 235 | + |
| 236 | + // Different content |
| 237 | + expect($message1->is($message3))->toBeFalse(); |
| 238 | +}); |
0 commit comments