PHP code example of mrvokia / mailhub

1. Go to this page and download the library: Download mrvokia/mailhub 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/ */

    

mrvokia / mailhub example snippets


use MrVokia\MailHub\MailHub;

/**
 * Send mail
 */
public function example(MailHub $mailhub)
{
	$mailhub->send()
        	->to(['[email protected]', '[email protected]'])
        	->cc(['[email protected]'])
        	->subject('example')
        	->html('example content')
        	->start()
	//or
	MailHub::send()
			->to(['[email protected]', '[email protected]'])
			->cc(['[email protected]'])
			->subject('example')
			->html('example content')
			->start()
}

/**
 * Send template mail
 */
public function exampleTemplate(MailHub $mailhub)
{
	$mailhub->send()
        	->to(['[email protected]', '[email protected]'])
        	->subject('example')
        	->xsmtpapi([
				'active' => ['test', 'test2']
			])
        	->templateInvokeName('mail.register')
        	->start()
	//or
	MailHub::send()
       		->to(['[email protected]', '[email protected]'])
       		->cc(['[email protected]'])
       		->subject('example')
        	->xsmtpapi([
				'active' => ['test', 'test2']
			])
        	->templateInvokeName('mail.register')
       		->start()
}