Rev 74 | Blame | Compare with Previous | Last modification | View Log | RSS feed
<?phpuse PHPMailer\PHPMailer\PHPMailer;use PHPMailer\PHPMailer\Exception;error_reporting(E_ALL);if (!function_exists('PHPMailer_Init')) {function PHPMailer_Init() {// Include PHPMailer library filesrequire 'PHPMailer/Exception.php';require 'PHPMailer/PHPMailer.php';require 'PHPMailer/SMTP.php';$mail = new PHPMailer;return $mail;}}/** Reset new password email sender function*/if (!function_exists('forgotPassEmail')) {function forgotPassEmail($userData) {$resetPassLink = BASE_URL . 'resetPassword.php?fp_code=' . $userData['forgot_pass_identity'];$to = $userData['email'];$subject = "Password Reset Request | " . SITE_NAME;$mailContent ='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>Find Cheap Music Password Reset Request</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><meta name="viewport" content="width=device-width" /></head><body><table cellpadding="0" cellspacing="0" border="0" width="100%" style="border-radius:6px;background-color:#ffffff;padding-top:15px;border-collapse:separate"><tbody><tr><td style="color:#616471;font-weight:400;text-align:left;line-height:190%;padding-top:15px;padding-right:40px;padding-bottom:30px;padding-left:40px;font-size:15px"><h1 style="font-weight:500;font-size:22px;letter-spacing:-1px;line-height:115%;margin:18px 0 0;padding:0;text-align:left;color:#3c7bb6">Password Reset Request</h1><br/><p>Recently a request was submitted to reset a password for your account email ' . $to . '. If this was a mistake, just disregard this email and nothing will happen.</p><p>To reset your password, visit the following link:</p><table cellpadding="0" cellspacing="0" border="0" width="100%" style="border-collapse:collapse"><tbody><tr><td align="center" valign="middle" style="padding-top:25px;padding-right:15px;padding-bottom:25px;padding-left:15px"><table cellpadding="0" cellspacing="0" border="0" style="border-radius:.25em;background-color:#4582e8;border-collapse:separate"><tbody><tr><td align="center" valign="middle" style="border-radius:.25em;background-color:#4582e8;font-weight:400;min-width:180px;font-size:16px;line-height:100%;padding-top:18px;padding-right:30px;padding-bottom:18px;padding-left:30px;color:#ffffff"><a href="' . $resetPassLink . '" style="font-weight:500;color:#ffffff;text-decoration:none">Reset Password</a></td></tr></tbody></table></td></tr></tbody></table><p>Let us know at customerservice@FindCheapMusic.com in case of any query or feedback.</p><p>Regards,<br/><strong>' . SITE_NAME . ' Team</strong></p></td></tr></tbody></table></body></html>';$mailContentText = "Recently a request was submitted to reset a password for your account. If this was a mistake, just disregard this email and nothing will happen.\r\n\r\n";$mailContentText .= "To reset your password, visit the following link:\r\n\r\n$resetPassLink\r\n\r\n";$mailContentText .= "Let us know at customerservice@FindCheapMusic.com in case of any query or feedback.\r\n";$mailContentText .= "\r\nRegards,\r\n" . SITE_NAME . " Team";if (SMTP == true) {$mail = PHPMailer_Init();// SMTP configuration$mail->isSMTP();$mail->Host = SMTP_HOST;$mail->SMTPAuth = true;$mail->Username = SMTP_USERNAME;$mail->Password = SMTP_PASSWORD;$mail->SMTPSecure = SMTP_SECURE;$mail->Port = SMTP_PORT;$mail->setFrom(SENDER_EMAIL, SENDER_NAME);// Add a recipient$mail->addAddress($to);// Email subject$mail->Subject = $subject;// Set email format to HTML$mail->isHTML(true);// Email body content$mail->Body = $mailContent;$mail->AltBody = $mailContentText;// DKIM$mail->DKIM_domain = DKIM_DOMAIN;$mail->DKIM_private = $_SERVER['DOCUMENT_ROOT'] . DKIM_PRIVATE;$mail->DKIM_selector = DKIM_SELECTOR;$mail->DKIM_passphrase = DKIM_PASSPHRASE;$mail->DKIM_identity = $mail->From;$mail->DKIM_copyHeaderFields = false;$mail->DKIM_extraHeaders = ['List-Unsubscribe', 'List-Help'];// Send emailif (!$mail->send()) {error_log('Mailer error: ' . $mail->ErrorInfo);}}else {//set content-type header for sending HTML email$headers = "MIME-Version: 1.0" . "\r\n";$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";//additional headers$headers .= 'From: ' . SENDER_NAME . '<' . SENDER_EMAIL . '>' . "\r\n";//send emailmail($to, $subject, $mailContent, $headers);}return true;}}/** Account verification email sender function*/if (!function_exists('emailVerification')) {function emailVerification($userData) {$emailVerifyLink = BASE_URL . 'userAccount.php?verifyEmail=1&ac_code=' . $userData['activation_code'];$to = $userData['email'];$subject = "Please Confirm Your Email | " . SITE_NAME;$mailContent ='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>Find Cheap Music Email Confirmation</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><meta name="viewport" content="width=device-width" /></head><body><table cellpadding="0" cellspacing="0" border="0" width="100%" style="border-radius:6px;background-color:#ffffff;padding-top:15px;border-collapse:separate"><tbody><tr><td style="color:#616471;font-weight:400;text-align:left;line-height:190%;padding-top:15px;padding-right:40px;padding-bottom:30px;padding-left:40px;font-size:15px"><h1 style="font-weight:500;font-size:22px;letter-spacing:-1px;line-height:115%;margin:18px 0 0;padding:0;text-align:left;color:#3c7bb6">Email Confirmation</h1><br/>Thank you for signing up with Find Cheap Music! Please confirm your email address ' . $to . ' by clicking the link below.<table cellpadding="0" cellspacing="0" border="0" width="100%" style="border-collapse:collapse"><tbody><tr><td align="center" valign="middle" style="padding-top:25px;padding-right:15px;padding-bottom:25px;padding-left:15px"><table cellpadding="0" cellspacing="0" border="0" style="border-radius:.25em;background-color:#4582e8;border-collapse:separate"><tbody><tr><td align="center" valign="middle" style="border-radius:.25em;background-color:#4582e8;font-weight:400;min-width:180px;font-size:16px;line-height:100%;padding-top:18px;padding-right:30px;padding-bottom:18px;padding-left:30px;color:#ffffff"><a href="' . $emailVerifyLink . '" style="font-weight:500;color:#ffffff;text-decoration:none">Confirm Email</a></td></tr></tbody></table></td></tr></tbody></table>We look forward to serving you,<br/><strong>' . SITE_NAME . ' Team</strong></td></tr></tbody></table></body></html>';$mailContentText = "Thank you for signing up with Find Cheap Music! Please confirm your email address via this link:\r\n\r\n$emailVerifyLink\r\n\r\n";$mailContentText .= "\r\nWe look forward to serving you,\r\n" . SITE_NAME . " Team";if (SMTP == true) {$mail = PHPMailer_Init();// SMTP configuration$mail->isSMTP();$mail->CharSet = "text/html; charset=UTF-8;";$mail->WordWrap = 80;$mail->Host = SMTP_HOST;$mail->SMTPAuth = true;$mail->Username = SMTP_USERNAME;$mail->Password = SMTP_PASSWORD;$mail->SMTPSecure = SMTP_SECURE;$mail->Port = SMTP_PORT;$mail->setFrom(SENDER_EMAIL, SENDER_NAME);// Add a recipient$mail->addAddress($to);// Email subject$mail->Subject = $subject;// Set email format to HTML$mail->isHTML(true);// Email body content$mail->Body = $mailContent;$mail->AltBody = $mailContentText;// DKIM$mail->DKIM_domain = DKIM_DOMAIN;$mail->DKIM_private = $_SERVER['DOCUMENT_ROOT'] . DKIM_PRIVATE;$mail->DKIM_selector = DKIM_SELECTOR;$mail->DKIM_passphrase = DKIM_PASSPHRASE;$mail->DKIM_identity = $mail->From;$mail->DKIM_copyHeaderFields = false;$mail->DKIM_extraHeaders = ['List-Unsubscribe', 'List-Help'];// Send emailif (!$mail->send()) {error_log('Mailer error: ' . $mail->ErrorInfo);}}else {//set content-type header for sending HTML email$headers = "MIME-Version: 1.0" . "\r\n";$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";//additional headers$headers .= 'From: ' . SENDER_NAME . '<' . SENDER_EMAIL . '>' . "\r\n";//send emailmail($to, $subject, $mailContent, $headers);}return true;}}