HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux wordpress-ubuntu-s-2vcpu-4gb-fra1-01 5.4.0-169-generic #187-Ubuntu SMP Thu Nov 23 14:52:28 UTC 2023 x86_64
User: root (0)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/delta/wp-content/plugins/sg-cachepress/vendor/siteground/siteground-emails/readme.md
SiteGround Email Service for WordPress
=========

The script can be used to generate an email and schedule it to be sent on specific time interval. It uses default WP Mail function.

Installation
=====
	
	composer require siteground/siteground-emails

Usage
=====

	use SiteGround_Emails\Email_Service;
	
	// Initiate the Email Service Class.
	$this->email = new Email_Service(
		'email_cron', // *REQUIRED* Type: string. Cron event name.
		'weekly', // *REQUIRED* Type: string. Cron event interval. The default supported recurrences are ‘hourly’, ‘twicedaily’, ‘daily’, and ‘weekly’.
		time(), // *REQUIRED* Type: int. Timestamp used to schedule the cron event.
		array(
			'headers'           => array( '' ); // *Optional* Type: string[].
			'recipients_option' => 'database option where the message receipients are being stored', // *REQUIRED* Type: string[]. List of email addresses.
			'subject'           => 'Message Subject', // *REQUIRED* Type: string. Message subject.
			'body_method'       => array( 'NAMESPACE', 'Generate message body method' ), // *REQUIRED* Type: array. Array of the namespace and the method which will generate the message body.
		)
	);

	// Schedule the event.
	$this->email->schedule_event();

With the above code you will have a weekly cron event sending email to the defined recipients.

Make sure to include the defined Cron name as an action in the plugin and link it to the siteground-emails 'sg_handle_email' method.

In case you want to stop sending the messages you can call the unschedule_event method as follows:

	// Unschedule the event.
	$this->email->unschedule_event();

Notes
=====

Cron name, inteval and timestamp should be defined in the order listed above. Message arguments can be passed in mixed order.

License
=====

GPLv3 http://www.gnu.org/licenses/gpl-3.0.html