<?php
/*
NmnNewsletter is a library that provides newsletter service
management for websites running php and mysql.
Copyright (C) 2006 Ivan Preziosi from netmeans.net - Rome.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
For more informations or to join the development of the library contact
the author at: hide@address.com
*/
require_once 'phpMailer/mailUtil.php';
class NewsletterConfirmation{
function sendSubscribeConfirm($idUser){
$userInfo = NewsletterUsers::getUser($idUser);
$confirmationLink = getSubscribeHref($idUser);
$confirmationSubject = SUBSCRIPTION_CONFIRMATION_SUBJECT;
$html_mail = SUBSCRIPTION_CONFIRMATION_HTML_MAIL;
$html_mail = str_replace(":|:CONFIRMATION_HREF:|:", $confirmationLink, $html_mail);
$text_mail = SUBSCRIPTION_CONFIRMATION_TEXT_MAIL;
$text_mail = str_replace(":|:CONFIRMATION_HREF:|:", $confirmationLink, $text_mail);
$isSent = sendEmail(SMTP_HOST, SMTP_USER, SMTP_PASSWORD, MAIL_FROM, NAME_FROM, $userInfo["email"], $userInfo["email"], $confirmationSubject, $text_mail, $html_mail,'');
if ($isSent){
//NmnLogger::logString("Subscription confirmation request succesfully sent to recipient:". $userInfo["email"]."");
}else{
//NmnLogger::logString("Subscription confirmation request NOT succesfully sent to recipient:". $userInfo["email"]."");
}
}
function sendUnsubscribeConfirm($idUser){
$userInfo = NewsletterUsers::getUser($idUser);
$confirmationLink = SITE_URL.APPLICATION_PATH."confirmUnsubscription.php?usrid=".$userInfo["id_".DB_USERS_TABLE];
$confirmationSubject = UNSUBSCRIPTION_CONFIRMATION_SUBJECT;
$html_mail = UNSUBSCRIPTION_CONFIRMATION_HTML_MAIL;
$html_mail = str_replace(":|:CONFIRMATION_HREF:|:", $confirmationLink, $html_mail);
$text_mail = UNSUBSCRIPTION_CONFIRMATION_TEXT_MAIL;
$text_mail = str_replace(":|:CONFIRMATION_HREF:|:", $confirmationLink, $text_mail);
$isSent = sendEmail(SMTP_HOST, SMTP_USER, SMTP_PASSWORD, MAIL_FROM, NAME_FROM, $userInfo["email"], $userInfo["email"], $confirmationSubject, $text_mail, $html_mail,'');
if ($isSent){
//NmnLogger::logString("Subscription confirmation request succesfully sent to recipient:". $userInfo["email"]."");
}else{
//NmnLogger::logString("Subscription confirmation request NOT succesfully sent to recipient:". $userInfo["email"]."");
}
}
}
?>