Email client within SC App & Alerts

Does anyone know of a way to create or include an email client within a SC app and send users alerts when new emails arrive?

I used an external library to create an email client: https://github.com/ddeboer/imap:

sc_include_library("prj", "ImapLib", "vendor/autoload.php", true, true);
$server = new Ddeboer \ Imap \Server(
		$hostname, 			// required
		$port,     			// defaults to '993'
		$flags    			// defaults to '/imap/ssl/validate-cert'
		//$parameters	
	);
	
	// Make the connection
	$connection = $server->authenticate($username, $passwd);
	
	// Get the mailboxes
	$mailboxes = $connection->getMailboxes();
	
	// Go through mailboxes 
	foreach($mailboxes as $mailbox)
	{