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
deep5011 opened this issue Nov 13, 2024 · 1 comment
Open

Thread #529

deep5011 opened this issue Nov 13, 2024 · 1 comment

Comments

@deep5011
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@deep5011 and others