diff --git a/inc/email_functions.inc.php b/inc/email_functions.inc.php index 87093f91..0ebc0735 100644 --- a/inc/email_functions.inc.php +++ b/inc/email_functions.inc.php @@ -46,6 +46,25 @@ if ($hesk_settings['smtp']) } } +function hesk_notifyCustomerForVerifyEmail($email_template = 'verify_email', $activationKey) +{ + global $hesk_settings, $ticket; + + if (defined('HESK_DEMO')) + { + return true; + } + + // Format email subject and message + $subject = hesk_getEmailSubject($email_template); + $message = hesk_getEmailMessage($email_template, null, 0, 0, 0); + $activationUrl = $hesk_settings['hesk_url'] . '/verifyemail.php?key=%%ACTIVATIONKEY%%'; + $message = str_replace('%%VERIFYURL%%', $activationUrl, $message); + $message = str_replace('%%ACTIVATIONKEY%%', $activationKey, $message); + + hesk_mail($ticket['email'], $subject, $message); +} + function hesk_notifyCustomer($email_template = 'new_ticket') { diff --git a/language/en/emails/verify_email.txt b/language/en/emails/verify_email.txt new file mode 100644 index 00000000..fa573f6f --- /dev/null +++ b/language/en/emails/verify_email.txt @@ -0,0 +1,10 @@ +Dear %%NAME%%, + +Your email needs to be verified before your ticket can be submitted. Please click the link below to verify your email. + +%%VERIFYURL%% + +Sincerely, + +%%SITE_TITLE%% +%%SITE_URL%% \ No newline at end of file diff --git a/submit_ticket.php b/submit_ticket.php index f78e2ccd..f02cadba 100644 --- a/submit_ticket.php +++ b/submit_ticket.php @@ -377,8 +377,8 @@ if ($verifiedEmailRS->num_rows == 0) hesk_dbQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."pending_verification_emails` (`Email`, `ActivationKey`) VALUES ('".$escapedEmail."', '".$escapedKey."')"); - /* TODO Send email to customer asking to verify email address. A link with the activation key will be in the email - for them to visit to activate. */ + require(HESK_PATH . 'inc/email_functions.inc.php'); + hesk_notifyCustomer('verify_email'); } else { //-- email has been verified, and a ticket can be created