email after list php plugin execution

jo-ka

Member
Hello.

I have a list plugin which will run a PHP code to update some fields I want to, and create a button in fromt of each list record . I want to send an email after this update, but I can't find a way, although I think I've already done this a long time ago.

Am I using the wrong plugin? O r am I missing something.

Thanks in advance.
 
OK, thanks, I'll give it a try.

Is there any wiki or so where I can see how this works?

I've tried to add this to my code, following an example of these thread http://fabrikar.com/forums/index.ph...te-owner-debug-eval-except.47628/#post-247128, but I get an error saying I need to add a destination email...

FabrikWorker::sendMail("somemail@mail.mail", "My subject","Hello",true);

Also tried like this:

FabrikWorker::sendMail("somemail@mail.mail", "somemail2@mail.mail", "My subject","Hello",true);

What's wrong here?
 
Here's my code...

$db = JFactory::getDbo();
$ids = JRequest::getVar('ids', array());
//Query que valida a exist?ncia de uma ?poca com estado: Pr?xima
$sql = "SELECT id FROM fab_epocas WHERE fab_epocas.estado = '2'";
$db->setQuery($sql);
$nextseason = $db->loadAssoc();

//var_dump($nextseason);
//die();

foreach ($ids AS $id)
{
$row = $model->getRow($id);
$element = $row->fab_juizes___utilizador;
$element_raw = $row->fab_juizes___utilizador_raw;
//actualiza a ?poca para a epoca seguinte de acordo com as condi??es definidas.
if ($nextseason['id'] === NULL){
$update = "UPDATE fab_juizes SET fab_juizes.epoca = (SELECT fab_epocas.id FROM fab_epocas WHERE fab_epocas.estado = '0' ) WHERE fab_juizes.id=" . (int)$id;
}
else{
$update = "UPDATE fab_juizes SET fab_juizes.epoca = (SELECT fab_epocas.id FROM fab_epocas WHERE fab_epocas.estado = '2' ) WHERE fab_juizes.id=" . (int)$id;
}

//envia email
FabrikWorker::sendMail("somemail@mail.mail", "My subject","Hello",true);
#
$db->setQuery($update);
$db->query();
}
 
/**
* Function to send an email
*
* @param string $from From email address
* @param string $fromName From name
* @param mixed $recipient Recipient email address(es)
* @param string $subject email subject
* @param string $body Message body
* @param boolean $mode false = plain text, true = HTML
* @param mixed $cc CC email address(es)
* @param mixed $bcc BCC email address(es)
* @param mixed $attachment Attachment file name(s)
* @param mixed $replyTo Reply to email address(es)
* @param mixed $replyToName Reply to name(s)
* @param array $headers Optional custom headers, assoc array keyed by header name
*
* @return boolean True on success
*
* @since 11.1
*/
public static function sendMail($from, $fromName, $recipient, $subject, $body, $mode = false,
$cc = null, $bcc = null, $attachment = null, $replyTo = null, $replyToName = null, $headers = array())
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top