You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Once you retrieve messages from a folder using methods like `$inbox->messages()->get()`, you'll receive instances of the `Message` class.
265
263
266
264
This class offers a rich set of helper methods for interacting with individual emails, making it easy to inspect, modify, and manipulate messages.
267
265
268
-
#####Retrieving Message Information
266
+
#### Retrieving Message Information
269
267
270
268
The `Message` class provides several methods to access basic properties:
271
269
@@ -283,7 +281,7 @@ The `Message` class provides several methods to access basic properties:
283
281
-`date()`: Returns the message’s date as a Carbon instance (if available).
284
282
-`messageId()`: Retrieves the Message-ID header (globally unique identifier for the message).
285
283
286
-
#####Address Handling
284
+
#### Address Handling
287
285
288
286
To conveniently work with email addresses, the `Message` class includes methods that return addresses as instances of the `Address` class:
289
287
@@ -295,22 +293,22 @@ To conveniently work with email addresses, the `Message` class includes methods
295
293
-`cc()`: An array of CC addresses.
296
294
-`bcc()`: An array of BCC addresses.
297
295
298
-
#####Content Retrieval
296
+
#### Content Retrieval
299
297
300
298
For accessing the message content in different formats:
301
299
302
300
-`html()`: Returns the HTML version of the message (if available).
303
301
-`text()`: Returns the plain text version of the message (if available).
304
302
305
-
#####Attachment Handling
303
+
#### Attachment Handling
306
304
307
305
Messages that include attachments can be inspected with:
308
306
309
307
-`attachments()`: Returns an array of `Attachment` objects.
310
308
-`hasAttachments()`: Checks if the message contains any attachments.
311
309
-`attachmentCount()`: Returns the number of attachments in the message.
312
310
313
-
#####Flag Operations
311
+
#### Flag Operations
314
312
315
313
The class also provides methods to modify message flags, which help you manage the state of a message:
316
314
@@ -328,23 +326,23 @@ The class also provides methods to modify message flags, which help you manage t
328
326
329
327
All these methods work by invoking the underlying IMAP `STORE` command (with the appropriate flag and operation), and optionally expunging the folder afterward.
330
328
331
-
#####Message Manipulation
329
+
#### Message Manipulation
332
330
333
331
Beyond just flagging, you can move or copy messages between folders, or even delete them:
334
332
335
333
-`copy(string $folder, bool $expunge = true)`: Copies the message to the specified folder.
336
334
-`move(string $folder, bool $expunge = true)`: Moves the message to the specified folder.
337
335
-`delete(bool $expunge = true)`: Marks the message as deleted and, if desired, expunges it from the folder.
338
336
339
-
#####Parsing and String Conversion
337
+
#### Parsing and String Conversion
340
338
341
339
-`parse()`: Parses the raw message data into a `MailMimeMessage` instance for deeper inspection (e.g., extracting structured content, attachments, etc.).
342
340
> **Note:** An exception is thrown if both headers and contents are empty.
343
341
-`__toString()`: Converts the message back to its full raw string (headers and contents combined), which is useful for logging or re-sending the email.
344
342
345
343
---
346
344
347
-
#####Example: Interacting with a Retrieved Message
345
+
#### Example: Interacting with a Retrieved Message
0 commit comments