Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thread #529

Open
deep-txtech opened this issue Nov 13, 2024 · 1 comment
Open

Thread #529

deep-txtech opened this issue Nov 13, 2024 · 1 comment
Labels
help wanted Extra attention is needed

Comments

@deep-txtech
Copy link

$folders = [
$client->getFolder('INBOX'),
];
$sent = $client->getFolder("[Gmail]/Sent Mail");
$today = Carbon::today();
$yesterday = Carbon::today()->subDays(1);
foreach ($folders as $folder) {
$messages = $folder->query()->since($yesterday)->from($toEmail)->to($fromEmail)->all()->get();
foreach ($messages as $message) {
$emailThreads[] = [
'from_email' => $message->getFrom()[0]->mail,
'to_email' => $message->getTo()[0]->mail,
'to_name' => $message->getTo()[0]->full,
'from_name' => $message->getFrom()[0]->full,
'subject' => $message->getSubject()[0],
'body' => $message->getHTMLBody(),
'reply_date' => $message->getDate()[0]->toDateTimeString(),
'message_id' => $message->getAttributes()['message_id'][0],
'refrence_id' => isset($message->getAttributes()["references"][0]) ? $message->getAttributes()["references"][0] : '',
'check_attachment' => $message->hasAttachments(),
'attachment' => $message->getAttachments(),
'date' => $message->getDate()->toDate(),
];
}
}
This is my logic to fetch the emails in the inbox folder I want the whole thread of it to help me to solve this

@Webklex Webklex added the help wanted Extra attention is needed label Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants
@Webklex @deep-txtech and others