57 lines
1.9 KiB
PHP
57 lines
1.9 KiB
PHP
<?php
|
|
defined($security_key) or exit;
|
|
|
|
//------------------------------------------
|
|
// Products attributes
|
|
//------------------------------------------
|
|
//Connect to DB
|
|
$pdo = dbConnect($dbname);
|
|
|
|
//CONTENT FROM API (POST)
|
|
$post_content = json_decode($input,true);
|
|
|
|
//VALIDATE INPUT CRITERIA
|
|
if (isset($post_content['type']) && $post_content['type'] !=''){
|
|
//GET TYPE OF EMAIL
|
|
$mail_type = $post_content['type'] ?? '';
|
|
$mail_content = isset($post_content['content']) ? $post_content['content']: '';
|
|
$mail_subject = isset($post_content['subject']) ? $post_content['subject']: '';
|
|
$mail_to = isset($post_content['to']) ? $post_content['to']: email;
|
|
|
|
//QUERY AND VERIFY ALLOWED
|
|
if ($command == 'update' && isAllowed('mailer',$profile,$permission,'U') === 1){
|
|
|
|
//CHECK MAIL TYPE
|
|
switch ($mail_type) {
|
|
case 'contactform':
|
|
|
|
//GET TEMPLATE
|
|
$mail_location = (file_exists($_SERVER['DOCUMENT_ROOT'].'/custom/'.$domain.'/mail/email_template_contactform.php') ? $_SERVER['DOCUMENT_ROOT'].'/custom/'.$domain.'/mail/email_template_contactform.php' : './assets/mail/email_template_contactform.php');
|
|
include_once $mail_location;
|
|
|
|
//SEND MAIL
|
|
send_mail($mail_to,$mail_subject,$message,'','');
|
|
echo json_encode(array('status' => 'send'));
|
|
break;
|
|
|
|
case 'reset':
|
|
|
|
//GET TEMPLATE
|
|
$mail_location = (file_exists($_SERVER['DOCUMENT_ROOT'].'/custom/'.$domain.'/mail/email_template_reset.php') ? $_SERVER['DOCUMENT_ROOT'].'/custom/'.$domain.'/mail/email_template_reset.php' : './assets/mail/email_template_reset.php');
|
|
include_once $mail_location;
|
|
|
|
//SEND MAIL
|
|
send_mail($mail_to,$subject,$message,'','');
|
|
break;
|
|
}
|
|
|
|
}
|
|
else
|
|
{
|
|
//do nothing
|
|
}
|
|
} else {
|
|
exit;
|
|
}
|
|
|
|
?>
|