joomla的参数全部使用Registry对象,Registry对象使用的方式:

use Joomla\Registry\Registry;
//实例化
$params = new Registry;
//获取一个参数
$purchase_type = $params->get('purchase_type');
//设置一个参数
$params->set('purchase_type','4');

获取一个组件的参数:

$params = JComponentHelper::getParams('com_banners');

获取一个插件的参数:

if($plugin = JPluginHelper::getPlugin('user','joomla')) {
    $params = new JRegistry($plugin->params);
} else {
    $params = new JRegistry;
}
var_dump($params);

获取当前模板的参数:

$params = $app->getTemplate(true)->params;

获取模块的参数以及输出:

//选择一个模块
$loginmod=JModuleHelper::getModule('mod_login','Login Form');
//参数获取
$params = new Registry;
$params->loadString($loginmod->params);
//内容输出获取
$output = JModuleHelper::renderModule($loginmod);
var_dump($params,$output);
 $app=JFactory::getApplication();
$this->comInfo['option'] = $app->input->get('option');
$this->comInfo['view'] = $this->get('_name');
$this->comInfo['models'] = implode(',',array_keys($this->get('_models')));
$this->comInfo['model'] = $this->get('_defaultModel');
$this->comInfo['layout'] = $this->getLayout();

$app = JFactory::getApplication();
$this->comInfo = new stdClass();
$this->comInfo->option = $app->input->get('option');
$this->comInfo->view = $this->get('_name');
$this->comInfo->models = implode(',',array_keys($this->get('_models')));
$this->comInfo->model = $this->get('_defaultModel');
$this->comInfo->layout = $this->getLayout();
//实例化与获取系统参数$mailer = JFactory::getMailer();
$config = JFactory::getConfig();
//设置发件人
$sender = array(
$config->get('mailfrom'),
$config->get('fromname')
);
$mailer->setSender($sender);
//设置收件人
$recipient = array('person1@domain.com');
$mailer->addRecipient($recipient);
//设置内容
$body = 'aaa<img src="cid:logo_id" alt="logo"/></div>bbb';
$mailer->isHTML(true);
$mailer->Encoding = 'base64';
$mailer->setSubject('subject');
$mailer->setBody($body);
$mailer->AddEmbeddedImage(JPATH_COMPONENT.'/assets/logo128.jpg', 'logo_id', 'logo.jpg', 'base64', 'image/jpeg');
$mailer->addAttachment(JPATH_COMPONENT.'/assets/document.pdf');
//发送邮件
$send = $mailer->Send();
if ($send !== true) {
echo 'Error sending email: ' . $send->__toString();
} else {
echo 'Mail sent';
}

方法 isHTML(true) 是指开启html邮件模式。
属性 Encoding 用于发送HTML邮件你设置编码为base64,避免多余的字符输出。
通常应该设置编码为base64。
方法 AddEmbeddedImage 添加了HTML的图片,这里的图片附件使用了base64编码。
方法 addAttachment 添加了邮件的附件。

直接上代码

//获取对象与获取系统参数
$mailer = JFactory::getMailer();
$config = JFactory::getConfig();
//设置发件人
$sender = array(
$config->get('mailfrom'),
$config->get('fromname')
);
$mailer->setSender($sender);
//设置收件人
$recipient = array('person1@domain.com');
$mailer->addRecipient($recipient);
//设置内容
$mailer->setSubject('subject');
$mailer->setBody('body');
//发送邮件
$send = $mailer->Send();
if ($send !== true){
echo 'Error sending email: ' . $send->__toString();
} else {
echo 'Mail sent';
}