PHP code example of madbob / automail

1. Go to this page and download the library: Download madbob/automail library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

madbob / automail example snippets




use AutoMail\AutoMail;
use AutoMail\NotFoundException;

try {
	/*
		Pass your mail address to AutoMail::discover() to obtain an array with
		all available configurations, both for incoming and outgoing messages
	*/
	$configuration = AutoMail::discover('[email protected]');

	print_r($configuration);

	/*
		[
			'incoming' => [
				[
					'protocol' => 'IMAP',
					'hostname' => 'imapmail.libero.it',
					'port' => 993,
					'socketType' => 'SSL',
					'authentication' => 'password-cleartext',
					'username' => '[email protected]'
				],
				[
					'protocol' => 'POP3',
					'hostname' => 'popmail.libero.it',
					'port' => 995,
					'socketType' => 'SSL',
					'authentication' => 'password-cleartext',
					'username' => '[email protected]'
				]
			],
			'outgoing' => [
				[
					'protocol' => 'SMTP',
					'hostname' => 'smtp.libero.it',
					'port' => 465,
					'socketType' => 'SSL',
					'authentication' => 'password-cleartext',
					'username' => '[email protected]'
				]
			]
		]
	*/
}
catch(NotFoundException $e) {
	echo $e->getMessage();
}