本文整理匯總了PHP中JMail::getInstance方法的典型用法代碼示例。如果您正苦於以下問題:PHP JMail::getInstance方法的具體用法?PHP JMail::getInstance怎麽用?PHP JMail::getInstance使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類JMail
的用法示例。
在下文中一共展示了JMail::getInstance方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: createMailer
/**
* Create a mailer object
*
* @return JMail object
*
* @see JMail
* @since 11.1
*/
protected static function createMailer()
{
$conf = self::getConfig();
$smtpauth = $conf->get('smtpauth') == 0 ? null : 1;
$smtpuser = $conf->get('smtpuser');
$smtppass = $conf->get('smtppass');
$smtphost = $conf->get('smtphost');
$smtpsecure = $conf->get('smtpsecure');
$smtpport = $conf->get('smtpport');
$mailfrom = $conf->get('mailfrom');
$fromname = $conf->get('fromname');
$mailer = $conf->get('mailer');
// Create a JMail object
$mail = JMail::getInstance();
// Set default sender without Reply-to
$mail->SetFrom(JMailHelper::cleanLine($mailfrom), JMailHelper::cleanLine($fromname), 0);
// Default mailer is to use PHP's mail function
switch ($mailer) {
case 'smtp':
$mail->useSMTP($smtpauth, $smtphost, $smtpuser, $smtppass, $smtpsecure, $smtpport);
break;
case 'sendmail':
$mail->IsSendmail();
break;
default:
$mail->IsMail();
break;
}
return $mail;
}
示例2: jimport
/**
* Create a mailer object
*
* @access private
* @return object JMail
* @since 1.5
*/
private static function &_createMailer()
{
jimport('joomla.mail.mail');
$conf =& JFactory::getConfig();
$sendmail = $conf->getValue('config.sendmail');
$smtpauth = $conf->getValue('config.smtpauth');
$smtpuser = $conf->getValue('config.smtpuser');
$smtppass = $conf->getValue('config.smtppass');
$smtphost = $conf->getValue('config.smtphost');
$smtpsecure = $conf->getValue('config.smtpsecure');
$smtpport = $conf->getValue('config.smtpport');
$mailfrom = $conf->getValue('config.mailfrom');
$fromname = $conf->getValue('config.fromname');
$mailer = $conf->getValue('config.mailer');
// Create a JMail object
$mail =& JMail::getInstance();
// Set default sender
$mail->setSender(array($mailfrom, $fromname));
// Default mailer is to use PHP's mail function
switch ($mailer) {
case 'smtp':
$mail->useSMTP($smtpauth, $smtphost, $smtpuser, $smtppass, $smtpsecure, $smtpport);
break;
case 'sendmail':
$mail->useSendmail($sendmail);
break;
default:
$mail->IsMail();
break;
}
return $mail;
}
示例3: SendMails
function SendMails($userlist, $mailtype)
{
$app = JFactory::getApplication();
$database = JFactory::getDBO();
$mail_from = $app->getCfg('mailfrom');
$site_name = $app->getCfg('sitename');
// If mailfrom is not defined A super administrator is notified
if (!$mail_from || !$site_name) {
//get all super administrator
$query = 'SELECT name, email, sendEmail' . ' FROM #__users' . ' WHERE LOWER( usertype ) = "super administrator"';
$database->setQuery($query);
$rows = $database->loadObjectList();
$site_name = $rows[0]->name;
$mail_from = $rows[0]->email;
}
set_time_limit(0);
ignore_user_abort();
$mail_body = JTable::getInstance('bidmail');
if (!$mail_body->load($mailtype)) {
return;
}
if (!$mail_body->enabled) {
return;
}
if (!is_array($userlist)) {
if (is_object($userlist)) {
$userlist = array($userlist);
}
}
if (count($userlist) <= 0) {
return;
}
$database->setQuery('SELECT email FROM #__users WHERE id = ' . $database->quote($this->userid));
$auctioneerEMAIL = $database->loadResult();
$database->setQuery('SELECT email
FROM #__bids AS b
LEFT JOIN #__users u
ON u.id = b.userid
WHERE
auction_id = ' . $database->quote($this->id) . '
AND accept = 1');
$result = $database->loadResultArray();
if (!empty($result)) {
$winnerEMAILs = implode(',', $result);
}
foreach ($userlist as $can) {
if (!$can->email) {
continue;
}
$userBid = $this->getBestBid($can->id);
// ? Issues or Multiple domains and want to link to a particular domain name?
// Replace JURI::root(). with the desired domain ex: 'http:://xy.com'.
$url = JUri::getInstance()->toString(array('scheme', 'host', 'port')) . JRoute::_('index.php?option=com_bids&task=viewbids&id=' . $this->id . ':' . JFilterOutput::stringURLSafe($this->title));
$patterns = array('%NAME%', '%SURNAME%', '%AUCTIONTITLE%', '%AUCTIONDESCR%', '%AUCTIONSTART%', '%AUCTIONEND%', '%AUCTIONLINK%', '%BIDPRICE%', '%AUCTIONEEREMAIL%', '%WINNEREMAIL%');
$replacements = array($can->name, @$can->surname, $this->title, $this->description, $this->start_date, $this->end_date, $url, isset($userBid->bid_price) ? $userBid->bid_price : 0, $auctioneerEMAIL, $winnerEMAILs);
$subj = str_replace($patterns, $replacements, $mail_body->subject);
$mess = str_replace($patterns, $replacements, $mail_body->content);
$mail = JMail::getInstance();
$mail->sendMail($mail_from, $site_name, $can->email, $subj, $mess, true);
}
}
示例4: _createMailer
/**
* Create a mailer object
*
* @return JMail object
* @since 11.1
*/
protected static function _createMailer()
{
jimport('joomla.mail.mail');
$conf = self::getConfig();
$sendmail = $conf->get('sendmail');
$smtpauth = $conf->get('smtpauth') == 0 ? null : 1;
$smtpuser = $conf->get('smtpuser');
$smtppass = $conf->get('smtppass');
$smtphost = $conf->get('smtphost');
$smtpsecure = $conf->get('smtpsecure');
$smtpport = $conf->get('smtpport');
$mailfrom = $conf->get('mailfrom');
$fromname = $conf->get('fromname');
$mailer = $conf->get('mailer');
// Create a JMail object
$mail = JMail::getInstance();
// Set default sender
$mail->setSender(array($mailfrom, $fromname));
// Default mailer is to use PHP's mail function
switch ($mailer) {
case 'smtp':
$mail->useSMTP($smtpauth, $smtphost, $smtpuser, $smtppass, $smtpsecure, $smtpport);
break;
case 'sendmail':
$mail->IsSendmail();
break;
default:
$mail->IsMail();
break;
}
return $mail;
}
示例5: createMailer
/**
* Create a mailer object
*
* @return JMail object
*
* @see JMail
* @since 11.1
*/
protected static function createMailer()
{
$conf = self::getConfig();
$smtpauth = $conf->get('smtpauth') == 0 ? null : 1;
$smtpuser = $conf->get('smtpuser');
$smtppass = $conf->get('smtppass');
$smtphost = $conf->get('smtphost');
$smtpsecure = $conf->get('smtpsecure');
$smtpport = $conf->get('smtpport');
$mailfrom = $conf->get('mailfrom');
$fromname = $conf->get('fromname');
$mailer = $conf->get('mailer');
// Create a JMail object
$mail = JMail::getInstance();
// Clean the email address
$mailfrom = JMailHelper::cleanLine($mailfrom);
// Set default sender without Reply-to if the mailfrom is a valid address
if (JMailHelper::isEmailAddress($mailfrom)) {
// Wrap in try/catch to catch phpmailerExceptions if it is throwing them
try {
// Check for a false return value if exception throwing is disabled
if ($mail->setFrom($mailfrom, JMailHelper::cleanLine($fromname), false) === false) {
JLog::add(__METHOD__ . '() could not set the sender data.', JLog::WARNING, 'mail');
}
} catch (phpmailerException $e) {
JLog::add(__METHOD__ . '() could not set the sender data.', JLog::WARNING, 'mail');
}
}
// Default mailer is to use PHP's mail function
switch ($mailer) {
case 'smtp':
$mail->useSmtp($smtpauth, $smtphost, $smtpuser, $smtppass, $smtpsecure, $smtpport);
break;
case 'sendmail':
$mail->isSendmail();
break;
default:
$mail->isMail();
break;
}
return $mail;
}
示例6: jimport
/**
* Joomla!-specific function to get an instance of the mailer class
* @return JMail
*/
public function &getMailer()
{
jimport('joomla.mail.mail');
$sendmail = AEUtilJconfig::getValue('sendmail');
$smtpauth = AEUtilJconfig::getValue('smtpauth');
$smtpuser = AEUtilJconfig::getValue('smtpuser');
$smtppass = AEUtilJconfig::getValue('smtppass');
$smtphost = AEUtilJconfig::getValue('smtphost');
$smtpsecure = AEUtilJconfig::getValue('smtpsecure');
$smtpport = AEUtilJconfig::getValue('smtpport');
$mailfrom = AEUtilJconfig::getValue('mailfrom');
$fromname = AEUtilJconfig::getValue('fromname');
$mailer = AEUtilJconfig::getValue('mailer');
// Create a JMail object
$mail = JMail::getInstance();
// Default mailer is to use PHP's mail function
switch ($mailer) {
case 'smtp':
AEUtilLogger::WriteLog(_AE_LOG_DEBUG, "-- Using SMTP");
$mail->useSMTP($smtpauth, $smtphost, $smtpuser, $smtppass, $smtpsecure, $smtpport);
break;
case 'sendmail':
AEUtilLogger::WriteLog(_AE_LOG_DEBUG, "-- Using sendmail");
$mail->useSendmail($sendmail);
break;
default:
AEUtilLogger::WriteLog(_AE_LOG_DEBUG, "-- Using PHP email()");
$mail->IsMail();
break;
}
$mail->Encoding = '8bit';
$mail->CharSet = 'utf-8';
// Set default sender
$mail->setSender(array($mailfrom, $fromname));
return $mail;
}
示例7: _writeLogs
function _writeLogs($log_detailed, $send_report_only_to_admin = false)
{
if ($send_report_only_to_admin) {
$title_email = "jNews report for mailing:";
} else {
$title_email = "jNews mailing report";
}
$HTMLSent = 0;
$TextSent = 0;
$HTMLSentAll = $this->sentHTML;
$TextSentAll = $this->sentText;
if (!empty($HTMLSentAll)) {
foreach ($HTMLSentAll as $oneList) {
$HTMLSent = $HTMLSent + $oneList;
}
//enforeach
}
$TextSent = 0;
if (!empty($TextSentAll)) {
foreach ($TextSentAll as $oneList) {
$TextSent = $TextSent + $oneList;
}
//enforeach
}
// $timeNow = jnews::getNow( 0, true );
$timeNow = time();
$totalstr = $timeNow - $this->startTime;
$log_simple = 'Time to send: ' . $totalstr . ' ' . _JNEWS_SECONDS . "\r\n";
$log_simple .= 'Number of subscribers: ' . ($HTMLSent + $TextSent) . "\r\n";
$log_simple .= 'HTML format: ' . $HTMLSent . "\r\n";
$log_simple .= 'Text format: ' . $TextSent . "\r\n";
$format = defined('_DATE_FORMAT_LC') ? _DATE_FORMAT_LC : JText::_('DATE_FORMAT_LC');
if (version_compare(JVERSION, '3.0.0', '<')) {
$log_detailed = "\r\n" . "\r\n" . '*** ' . JHTML::_('date', 'now', $format) . ' ***' . "\r\n" . $log_detailed;
} else {
$log_detailed = "\r\n" . "\r\n" . '*** ' . JHtml::_('date', 'now', $format) . ' ***' . "\r\n" . $log_detailed;
}
if ($send_report_only_to_admin) {
$log_detailed = "Hello,\r\n" . $log_detailed . "\r\n";
} else {
$log_detailed = $log_simple . 'Details: ' . "\r\n" . $log_detailed . "\r\n";
}
if ($send_report_only_to_admin) {
$send = $log_detailed;
} else {
if ($GLOBALS[JNEWS . 'send_log_simple']) {
$send = $log_simple;
} else {
$send = $log_detailed;
}
}
if (version_compare(JVERSION, '1.6.0', '<')) {
//j15
$this->db->setQuery("SELECT * FROM `#__users` WHERE `gid` = 25 ORDER BY `id` ASC LIMIT 1");
} else {
$this->db->setQuery("SELECT * FROM `#__users` AS U LEFT JOIN `#__user_usergroup_map` AS UGM ON U.id =UGM.user_id WHERE `group_id` = 8 ORDER BY `id` ASC LIMIT 1");
}
$admin = $this->db->loadObject();
if (version_compare(JVERSION, '3.0.0', '>=')) {
$class_for_mail = JMail::getInstance();
}
if ($GLOBALS[JNEWS . 'send_log']) {
if (!empty($GLOBALS[JNEWS . 'send_log_email'])) {
$listOfAdminA = explode(',', $GLOBALS[JNEWS . 'send_log_email']);
if (!empty($listOfAdminA)) {
foreach ($listOfAdminA as $oneAdmin) {
if (empty($oneAdmin)) {
continue;
}
if (version_compare(JVERSION, '3.0.0', '<')) {
JUTility::sendMail($oneAdmin, $oneAdmin, $oneAdmin, $title_email, $send);
} else {
$class_for_mail->sendMail($oneAdmin, $oneAdmin, $oneAdmin, $title_email, $send);
}
}
} else {
if (version_compare(JVERSION, '3.0.0', '<')) {
JUTility::sendMail($admin->email, $admin->name, $admin->email, $title_email, $send);
} else {
$class_for_mail->sendMail($admin->email, $admin->name, $admin->email, $title_email, $send);
}
}
} else {
if (version_compare(JVERSION, '3.0.0', '<')) {
JUTility::sendMail($admin->email, $admin->name, $admin->email, $title_email, $send);
} else {
$class_for_mail->sendMail($admin->email, $admin->name, $admin->email, $title_email, $send);
}
}
} elseif ($GLOBALS[JNEWS . 'send_log_closed'] == 1 && connection_aborted()) {
if (!empty($GLOBALS[JNEWS . 'send_log_email'])) {
$listOfAdminA = explode(',', $GLOBALS[JNEWS . 'send_log_email']);
if (!empty($listOfAdminA)) {
foreach ($listOfAdminA as $oneAdmin) {
if (empty($oneAdmin)) {
continue;
}
if (version_compare(JVERSION, '3.0.0', '<')) {
JUTility::sendMail($oneAdmin, $oneAdmin, $oneAdmin, $title_email, $send);
} else {
//.........這裏部分代碼省略.........
示例8: createMailer
protected static function createMailer()
{
$input = JFactory::getApplication()->input;
$smtpauth = $input->get('smtp_auth', 0);
$smtpuser = $input->get('smtp_user', false, 'string');
$smtppass = $input->get('smtp_pass', false, 'string');
$smtphost = $input->get('smtp_host', false);
$smtpsecure = $input->get('smtp_secure', false);
$smtpport = $input->get('smtp_port', false);
$mailfrom = $input->get('from_email', false, 'string');
$fromname = $input->get('from_name', false);
$mailer = $input->get('mailer', false);
// Create a JMail object
$mail = JMail::getInstance();
// Set default sender without Reply-to
$mail->SetFrom(JMailHelper::cleanLine($mailfrom), JMailHelper::cleanLine($fromname), 0);
// Default mailer is to use PHP's mail function
switch ($mailer)
{
case 'smtp':
$mail->useSMTP($smtpauth, $smtphost, $smtpuser, $smtppass, $smtpsecure, $smtpport);
break;
case 'sendmail':
$mail->IsSendmail();
break;
default:
$mail->IsMail();
break;
}
return $mail;
}
示例9: sendMail
private function sendMail(&$user, $password)
{
$mainframe = JFactory::getApplication();
$db = EasyBlogHelper::db();
$name = $user->get('name');
$email = $user->get('email');
$username = $user->get('username');
$usersConfig = JComponentHelper::getParams('com_users');
$sitename = $mainframe->getCfg('sitename');
$useractivation = $usersConfig->get('useractivation');
$mailfrom = $mainframe->getCfg('mailfrom');
$fromname = $mainframe->getCfg('fromname');
$siteURL = JURI::base();
$subject = JText::sprintf('COM_EASYBLOG_REGISTER_MAIL_ACCOUNT_DETAILS', $name, $sitename);
$subject = html_entity_decode($subject, ENT_QUOTES);
if ($useractivation == 1) {
$task = '';
$key = '';
if (EasyBlogHelper::getJoomlaVersion() >= '1.6') {
$task = 'registration.activate';
$key = 'token';
} else {
$task = 'activate';
$key = 'activation';
}
$message = sprintf(JText::_('COM_EASYBLOG_REGISTER_MAIL_ACTIVATE'), $name, $sitename, $siteURL . "index.php?option=com_users&task=" . $task . "&" . $key . "=" . $user->get('activation'), $siteURL, $username, $password);
} else {
$message = sprintf(JText::_('COM_EASYBLOG_REGISTER_MAIL'), $name, $sitename, $siteURL, $username, $password);
}
$message = html_entity_decode($message, ENT_QUOTES);
$ids = EasyBlogHelper::getSAUsersIds();
$rows = array();
foreach ($ids as $id) {
$row = new stdClass();
$user = JFactory::getUser($id);
$row->name = $user->name;
$row->email = $user->email;
$row->sendEmail = $user->sendEmail;
$rows[] = $row;
}
// Send email to user
if (!$mailfrom || !$fromname) {
$fromname = $rows[0]->name;
$mailfrom = $rows[0]->email;
}
if (EasyBlogHelper::getJoomlaVersion() >= '3.0') {
$mail = JMail::getInstance();
$mail->sendMail($mailfrom, $fromname, $email, $subject, $message, true);
} else {
JUtility::sendMail($mailfrom, $fromname, $email, $subject, $message);
}
// Send notification to all administrators
$subject2 = sprintf(JText::_('Account details for'), $name, $sitename);
$subject2 = html_entity_decode($subject2, ENT_QUOTES);
// get superadministrators id
foreach ($rows as $row) {
if ($row->sendEmail) {
$message2 = sprintf(JText::_('COM_EASYBLOG_REGISTER_MAIL_ADMIN'), $row->name, $sitename, $name, $email, $username);
$message2 = html_entity_decode($message2, ENT_QUOTES);
if (EasyBlogHelper::getJoomlaVersion() >= '3.0') {
$mail = JMail::getInstance();
$mail->sendMail($mailfrom, $fromname, $row->email, $subject2, $message2, true);
} else {
JUtility::sendMail($mailfrom, $fromname, $row->email, $subject2, $message2);
}
}
}
}
示例10: email
/**
* Joomla!-specific function to get an instance of the mailer class
* @return JMail
*/
private static function &getMailer()
{
if(!defined('AKEEBACLI'))
{
$mailer =& JFactory::getMailer();
if(!is_object($mailer)) {
AEUtilLogger::WriteLog(_AE_LOG_WARNING,"Fetching Joomla!'s mailer was impossible; imminent crash!");
} else {
$emailMethod = $mailer->Mailer;
AEUtilLogger::WriteLog(_AE_LOG_DEBUG,"-- Joomla!'s mailer is using $emailMethod mail method.");
}
return $mailer;
}
jimport('joomla.mail.mail');
$sendmail = AEUtilJconfig::getValue('sendmail');
$smtpauth = AEUtilJconfig::getValue('smtpauth');
$smtpuser = AEUtilJconfig::getValue('smtpuser');
$smtppass = AEUtilJconfig::getValue('smtppass');
$smtphost = AEUtilJconfig::getValue('smtphost');
$smtpsecure = AEUtilJconfig::getValue('smtpsecure');
$smtpport = AEUtilJconfig::getValue('smtpport');
$mailfrom = AEUtilJconfig::getValue('mailfrom');
$fromname = AEUtilJconfig::getValue('fromname');
$mailer = AEUtilJconfig::getValue('mailer');
// Create a JMail object
$mail =& JMail::getInstance();
// Default mailer is to use PHP's mail function
switch ($mailer)
{
case 'smtp' :
AEUtilLogger::WriteLog(_AE_LOG_DEBUG,"-- Using SMTP");
$mail->useSMTP($smtpauth, $smtphost, $smtpuser, $smtppass, $smtpsecure, $smtpport);
break;
case 'sendmail' :
AEUtilLogger::WriteLog(_AE_LOG_DEBUG,"-- Using sendmail");
$mail->useSendmail($sendmail);
break;
default :
AEUtilLogger::WriteLog(_AE_LOG_DEBUG,"-- Using PHP email()");
$mail->IsMail();
break;
}
$mail->Encoding = '8bit';
$mail->CharSet = 'utf-8';
// Set default sender
$mail->setSender(array ($mailfrom, $fromname));
return $mail;
}
示例11: ban_ip
function ban_ip($ips_list = '')
{
$ips_to_ban = explode(';', $ips_list);
$ips_banned = explode(';', $this->_config_values['ban_ips']);
$ips_banned = array_merge($ips_banned, $ips_to_ban);
$ips_banned = array_unique($ips_banned);
asort($ips_banned);
$ban_ips = implode(';', $ips_banned);
if (substr($ban_ips, 0, 1) == ';') {
$ban_ips = substr($ban_ips, 1);
}
// initialize different variables
$db = JFactory::getDBO();
$query = 'update `#__aicontactsafe_config` set config_value = \'' . $ban_ips . '\' where config_key = \'ban_ips\'';
$db->setQuery($query);
$isOK = $db->query();
if ($isOK) {
// send a notification to the administrator
$from = $this->_app->getCfg('mailfrom');
$fromname = $this->_app->getCfg('fromname');
$email_recipient = $this->_app->getCfg('mailfrom');
$subject = JText::_('COM_AICONTACTSAFE_IP_AUTOMATICALLY_BLOCKED');
$body = JText::_('COM_AICONTACTSAFE_IP_AUTOMATICALLY_BLOCKED') . '<br />' . $ips_list . '<br />';
$mode = true;
$mail = JMail::getInstance();
$isOK = $mail->sendMail($from, $fromname, $email_recipient, $subject, $body, $mode);
} else {
$this->_app->_session->set('isOK:' . $this->_sTask, false);
JError::raiseError(500, $db->getErrorMsg());
return false;
}
return true;
}
示例12: mosMail
function mosMail($from, $fromname, $recipient, $subject, $body, $mode = 0, $cc = NULL, $bcc = NULL, $attachment = NULL, $replyto = NULL, $replytoname = NULL)
{
//return JUTility::sendMail($from, $fromname, $recipient, $subject, $body, $mode, $cc, $bcc, $attachment, $replyto, $replytoname );
if (version_compare(JVERSION, '3.0.0', 'lt')) {
return JUTility::sendMail($from, $fromname, $recipient, $subject, $body, $mode, $cc, $bcc, $attachment, $replyto, $replytoname);
} else {
$a = JMail::getInstance();
$a->sendMail($from, $fromname, $recipient, $subject, $body, $mode, $cc, $bcc, $attachment, $replyto, $replytoname);
}
}
示例13: foreach
//if ($result = $paypal->doPayment($_GET['token'], $_GET['PayerID'], $resultData)) {
if ($result = $paypal->doPayment(JRequest::getVar('token'), JRequest::getVar('PayerID'), $resultData)) {
//echo "Success! Transaction ID: ".$result['TRANSACTIONID'];
foreach ($result as $c => $v) {
JLog::add('doPayment - ' . $c . '=' . $v, JLog::INFO, 'paypal');
}
JLog::add('doPayment - End', JLog::INFO, 'paypal');
//print_r($resultData);
// Add points to the user
$amount = $result['AMT'];
$paypal_txn_id = $result['TRANSACTIONID'];
$model->addUserPoints($user->id, $amount);
// Add transaction ID to the database with status COMPLETED
$model->insertDonation($user->id, $amount, $paypal_txn_id, true);
// Send notification mail
$mail = JMail::getInstance();
$mail->setSubject(JText::_('COM_JTRINITYCORE_PAYPAL_EMAIL_NOTIFICATION_SUBJECT'));
$mail->setBody(JText::sprintf('COM_JTRINITYCORE_PAYPAL_EMAIL_NOTIFICATION_BODY', $paypal_txn_id, $user->username, $amount));
$mail->addRecipient($params->get("notificationmail"));
$mail->SetFrom($params->get("paypal_from"));
//$mail->AddAddress($params->get("notificationmail"));
if (!($err = $mail->Send())) {
JLog::add('Error sending paypal notification mail.', JLog::ERROR, 'paypal');
}
// Send mail to buyer
$mail->ClearAddresses();
$mail->ClearAllRecipients();
$mail->ClearReplyTos();
$mail->setSubject(JText::_('COM_JTRINITYCORE_PAYPAL_EMAIL_NOTIFICATION_USER_SUBJECT'));
$mail->setBody(JText::sprintf('COM_JTRINITYCORE_PAYPAL_EMAIL_NOTIFICATION_USER_BODY', $user->username, $amount, $paypal_txn_id));
$mail->addRecipient($user->email);