PHP code example of arckinteractive / mailgun_mailin

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

    

arckinteractive / mailgun_mailin example snippets



elgg_register_plugin_hook_handler('mailin:types', 'mailgun', function($hook, $type, $return) {

	$return['event'] = [
		'handler' => 'my_mailin_event_parser',
		'fields' => [
			'date',
			'location',
			'description',
		],
	];
});

function my_mailin_event_parser(\ArckInteractive\Mailgun\Message $message, $fields) {

	$date = strtotime($fields['date']);
	$location = $fields['location'];

	if (!$date || !$location) {
		return false;
	}

	// save the event
	// note that this will be performed via cron, so there is no logged in user
	// you will need to set ignored access after checking container/edit permissions

	return true;
}