File: /home/undanet/www/wp-content/themes/panoramic-child/inc/mail-functions.php
<?php
function sendEmailCandidatos($allcandidatosemailarray, $phase, $desc)
{
$subject =
sprintf(
__('Information about the call %s in which you participate', 'panoramic_child'), $desc
);
$startermessage = '<p>' . __('Hello', 'panoramic_child') . '</p><p>'
. sprintf(__('Information about the call %s in which you participate', 'panoramic_child'), $desc)
. '</p>';
$message['resreq'] = '<p>'
. __('The Requirement Compliance Resolution has been published on our website.', 'panoramic_child')
. '</p>';
$message['resexa'] = '<p>'
. __('The Resolution of the Opposition Phase has been published on our website.', 'panoramic_child')
. '</p>';
$message['resmer'] = '<p>'
. __('The Resolution of the Merit Contest Phase has been published on our website.', 'panoramic_child')
. '</p>';
$endedmessage = '<p>' . __('Greetings', 'panoramic_child') . '</p><p>'
. __('Web:', 'panoramic_child') . ' '
. '<a href="' . get_site_url() . '">' . get_site_url()
. '</a>' . '</p>';
foreach ($allcandidatosemailarray as $mailto) {
sendEmailto(
$mailto,
$subject,
$startermessage . $message[$phase] . $endedmessage
);
}
}
function sendEmailTribunal($mailto, $phase, $desc)
{
$subject['startReqs'] =
__('Starting today, the Requirements Compliance Phase begins.', 'panoramic_child');
$subject['startExam'] =
__('Starting today, the Opposition Phase begins.', 'panoramic_child');
$subject['startMerits'] =
__('Starting today, the Merit Contest Phase begins.', 'panoramic_child');
$message['startReqs'] = '<p>'
. __('As of today, the Requirements Compliance Phase begins, please indicate your comments and assessments in the call matrix.', 'panoramic_child')
. '</p>';
$message['startExam'] = '<p>'
. __('Starting today, the Opposition Phase begins.', 'panoramic_child')
. '</p>';
$message['startMerits'] = '<p>'
. __('Starting today, the Merit Contest Phase begins.', 'panoramic_child')
. '</p>';
$endedmessage = '<p>' . $desc . '</p><p>'
. __('Greetings', 'panoramic_child') . '</p><p>'
. __('Web:', 'panoramic_child') . ' '
. '<a href="' . get_site_url() . '">' . get_site_url()
. '</a>' . '</p>';
sendEmailto(
$mailto, $subject[$phase], $message[$phase] . $endedmessage
);
}
function send_email_convocatoria_espontanea($cvt, $name)
{
$attachment = array();
$subject = __('Free Call Form', 'panoramic_child');
$message = '<p>' . sprintf(__('The candidate %s has registered in a free call, for job: ', 'panoramic_child'), $name);
$message .= $cvt->getPuestotrabajo() . '</p>';
$message .= '<p>' . __('Greetings', 'panoramic_child') . '</p><p>'
. __('Web:', 'panoramic_child') . ' '
. '<a href="' . get_site_url() . '">' . get_site_url()
. '</a>' . '</p>';
if (
!is_null($cvt->getRutacv())
&& file_exists(ABSPATH . 'PortalEmpleo/docs' . $cvt->getRutacv())
) {
array_push($attachment, ABSPATH . 'PortalEmpleo/docs' . $cvt->getRutacv());
}
if (
!is_null($cvt->getRutacp())
&& file_exists(ABSPATH . 'PortalEmpleo/docs' . $cvt->getRutacp())
) {
array_push($attachment, ABSPATH . 'PortalEmpleo/docs' . $cvt->getRutacp());
}
$headers = [];
add_filter('wp_mail_content_type', function ($content_type) {
return 'text/html';
});
$headers[] =
'From: ' . get_bloginfo('name') . ' <' . get_option('admin_email') . '>'
. "\r\n";
wp_mail(get_option('admin_email'), $subject, $message, $headers, $attachment);
remove_filter('wp_mail_content_type', 'set_html_content_type');
}
?>