Hi all,
I'm facing an issue and I'm not sure if I'm missing something. Based on the Getting started example, I created a script, what should also output the sender's email address (from). However, the from output is empty and no from email address is outputted, while all the other information (subject line) is shown, so I assume that the connection and login is working. In the code you see what I already tried and what the result was. Any ideas?
I use the following code
$cm = new ClientManager($options = []);
$client = $cm->make([
'host' => '*****',
'port' => 993,
'encryption' => 'ssl',
'validate_cert' => true,
'username' => '******',
'password' => '*****',
'protocol' => 'imap'
]);
//Connect to the IMAP Server
$client->connect();
//Get all Mailboxes
/** @var \Webklex\PHPIMAP\Support\FolderCollection $folders */
$folders = $client->getFolders();
//Loop through every Mailbox
/** @var \Webklex\PHPIMAP\Folder $folder */
foreach($folders as $folder){
//Get all Messages of the current Mailbox $folder
/** @var \Webklex\PHPIMAP\Support\MessageCollection $messages */
$messages = $folder->messages()->all()->get();
/** @var \Webklex\PHPIMAP\Message $message */
foreach($messages as $message){
//echo $message->getFrom().'<br />'; //Outputs Sender name only
//echo $message->getFrom()->mail.'<br />'; // Outputs Error Undefined property: Webklex\PHPIMAP\Attribute::$mail
//echo $message->getFrom()[0]->mail.'<br />'; // Outputs Error Undefined array key 0
//echo $message->from()[0]->mail.'<br />'; // Outputs Error Undefined array key 0
//echo $message->from().'<br />'; // Outputs Error Method Webklex\PHPIMAP\Message::from() is not supported
//echo $message->from[0]->mail.'<br />'; // Outputs Error Undefined array key 0
echo $message->getSubject().'<br />';
echo "<hr>";
}
}
Hi all, I'm facing an issue and I'm not sure if I'm missing something. Based on the Getting started example, I created a script, what should also output the sender's email address (from). However, the from output is empty and no from email address is outputted, while all the other information (subject line) is shown, so I assume that the connection and login is working. In the code you see what I already tried and what the result was. Any ideas?
I use the following code