<?php

$giveaway = sg_get_giveaways(array(
	'posts_per_page' => 1,
	'order' => 'DESC'
));

if ( ! $giveaway ) {
	$giveaway = get_posts(array(
		'posts_per_page' => 1,
		'post_type' => 'post'
	));
}

if ( ! $giveaway ) {
	$giveaway = get_posts(array(
		'posts_per_page' => 1,
		'post_type' => 'page'
	));
}

if ( $giveaway ) {
	$giveaway = $giveaway[0]->ID;
} else {
	$giveaway = 0;
}

$subscriber = new SG_Subscriber();
$subscriber->entry_id = 1;
$subscriber->data = array(
	'email'   => 'dummy@email.com',
	'post_id' => $giveaway,
	'status' => 'pending',
	'entries' => 1,
	'ref_id' => md5('something'),
	'id'     => 1
);

$email = new SG_Email_Subscriber();
$email->set_subscriber( $subscriber );
$settings = giveasap_get_settings();

$subscriber_email = isset( $settings['subscriber_email'] ) ? $settings['subscriber_email']  : '';
$email_subject    = isset( $settings['subscriber_email_subject'] ) ? $settings['subscriber_email_subject'] : __( 'Thank you, {{TITLE}} for entering in this giveaway', 'giveasap' );

$content = $email->get_email_content( $subscriber_email, $subscriber );

echo $email->get_content( $content );