send email on camp apply
This commit is contained in:
@@ -190,6 +190,53 @@ class camp_apply
|
||||
{
|
||||
global $sql;
|
||||
$sql->update_table('camp_apply', ['capp_status' => $_status_id, 'capp_accept_date' => date('Y-m-d H:i:s')], ['capp_id' => $_apply_id]);
|
||||
|
||||
if (3 == $_status_id) {
|
||||
$email_template_id = $sql->single_variable('select et_id from email_template where et_name = \'camp_reply\'');
|
||||
if (null !== $email_template_id) {
|
||||
$emailTemplate = new email_template();
|
||||
$emailTemplate->set_et_data_by_id($email_template_id);
|
||||
|
||||
//felelős kapcstartó emailere küld
|
||||
$contact = self::get_responsible_contact2($_apply_id);
|
||||
|
||||
$raw_subject = $emailTemplate->get_et_subject();
|
||||
$raw_message = $emailTemplate->get_et_message();
|
||||
//var_dump($toNotify_array);
|
||||
//foreach ($toNotify_array as $toNotify) {
|
||||
$personalizedSubject = $emailTemplate->personalize($raw_subject, [
|
||||
]);
|
||||
|
||||
$personalizedMessage = $emailTemplate->personalize($raw_message, [
|
||||
]);
|
||||
|
||||
$mail = new PHPMailer(true); // Passing `true` enables exceptions
|
||||
|
||||
$mail->SMTPDebug = 0; // Enable verbose debug output
|
||||
$mail->isSMTP(); // Set mailer to use SMTP
|
||||
$mail->CharSet = PHPMailer::CHARSET_UTF8; // UTF-8
|
||||
$mail->Host = 'mail.livingsport.hu '; // Specify main and backup SMTP servers
|
||||
$mail->SMTPAuth = true; // Enable SMTP authentication
|
||||
$mail->Username = 'notify@livingsport.hu'; // SMTP username
|
||||
$mail->Password = 'dpDiKSqU0V'; // SMTP password
|
||||
$mail->SMTPSecure = 'ssl'; // Enable TLS encryption, `ssl` also accepted
|
||||
$mail->Port = 465;
|
||||
|
||||
//Recipients
|
||||
$mail->setFrom($emailTemplate->get_et_from_email(), $emailTemplate->get_et_from_name());
|
||||
$mail->addAddress($contact->get_cc_email(), $contact->get_cc_name());
|
||||
//$mail->addAddress('tricsusz@gmail.com', 'Tóth Richárd'); // TEST
|
||||
|
||||
//Content
|
||||
$mail->isHTML(true); // Set email format to HTML
|
||||
$mail->Subject = $personalizedSubject;
|
||||
$mail->Body = $personalizedMessage;
|
||||
$mail->AltBody = 'Az Ön levelezője nem támogatja a HTML tartalom megjelenítését!';
|
||||
|
||||
//send mail
|
||||
$mail->send();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function has_contact($_capp_id)
|
||||
@@ -231,6 +278,16 @@ class camp_apply
|
||||
return $cc;
|
||||
}
|
||||
|
||||
public static function get_responsible_contact2($_id)
|
||||
{
|
||||
global $sql;
|
||||
$cc_id = $sql->single_variable('SELECT cac_camp_contact_cc_id FROM camp_apply_contact WHERE cac_camp_apply_capp_id = '.$_id.' AND cac_is_responsible = 1;');
|
||||
$cc = new camp_contact();
|
||||
$cc->set_cc_data_by_id($cc_id);
|
||||
|
||||
return $cc;
|
||||
}
|
||||
|
||||
//egy létező jelentkezésnél felelős kapcsolattartóra állít valakit
|
||||
public static function make_contact_responsible($_apply_id, $_cc_id, $_is_responsible = false)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user