I am building a ticket system for an intranet. I have succesfully integrated chronoforms and chronoconnectivity to accomplish this (Thanks heaps for a fantastic product!) I have enabled file attachments, can view records as plain results, and can edit those results with populated data and add additional notes for IT users. But IT are always asking for additional functionality, and this time I'm stumped...
Request: to be able to send an email to any user (based on manual input of an email address) on edit or addition of notes in the chronoconnectivity form...which equates to sending an email on Save(yes/no?).
So, for the Record Edit template I add an input field for the email address (though I don't care to store this in the db)
Now in the onSaveCode textarea I place:
Pretty simple...but no glory. I have tried putting in absolute variables ($msg = "hello";) for all and still no glory. Is there something in the CC system that blocks this, is my code fubar? or should this be in the "Attach to Forma tag"(still no work)
Any help, suggestions greatly appreciated...
Request: to be able to send an email to any user (based on manual input of an email address) on edit or addition of notes in the chronoconnectivity form...which equates to sending an email on Save(yes/no?).
So, for the Record Edit template I add an input field for the email address (though I don't care to store this in the db)
<input type="text" name="email" id="email" value="" />
Now in the onSaveCode textarea I place:
<?php
$msg = '{call_id} {call_descr} {call_probl} {notes}' ;
$to = {email};
$subject = {call_descr};
$message = $msg;
$from = 'From: webmaster' . 'Reply-To: webmaster@example.com';
mail($to, $subject, $message, $from);
?>
Pretty simple...but no glory. I have tried putting in absolute variables ($msg = "hello";) for all and still no glory. Is there something in the CC system that blocks this, is my code fubar? or should this be in the "Attach to Forma tag"(still no work)
Any help, suggestions greatly appreciated...
Hi cjcrun,
I'd guess that the $from line is the problem there, I think it only takes plain email addresses or name <email> pairs.
Here's a working code block using the Joomla mailer
Bob
I'd guess that the $from line is the problem there, I think it only takes plain email addresses or name <email> pairs.
Here's a working code block using the Joomla mailer
$from = "admin@my_site.com";
$fromname = "Admin";
$recipients = array('user_1@example.com', 'user_1@example.com');
$subject = "New inquiry";
$email_body = "<div>There's been a new inquiry</div>
<div>Name: ".$post['first_name']." ".$post['last_name']."<br />
Phone: ".$post['phone']."<br />
Mobile: ".$post['mobile']."<br />
Email: ".$post['email']."</div>";
$email_body = "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">
<html><head><title></title><base href=\"JURI::base()/\" /></head>
<body>$email_body</body>
</html>";
$mode = true;
// Note: CC & BCC don't work with PHP Mail Function
$ccemails = $bccemails = $attachments = null;
$replyto_email = $from;
$replyto_name = $fromname;
$email_sent = JUtility::sendMail($from, $fromname, $recipients, $subject, $email_body, $mode, $ccemails, $bccemails, $this_attachments, $replyto_email, $replyto_name );
Note: Your data probably isn't in the $post array.Bob
Thanks Bob,
I have unsuccessfully tried many variations using your code; haven't given up, but must move on for now. This will be something that is needed for us in the future, and I hope to make it work, as well will post when I have succeeded.
On an alternate thought, as you have succesfully built the plugin for chronoforms to be displayed in an article{chronocontact}...any thoughts on having chronoconnectivity doing the same? this may be a simple solution to all solutions for pdf, print etc...
Take care legend!
I have unsuccessfully tried many variations using your code; haven't given up, but must move on for now. This will be something that is needed for us in the future, and I hope to make it work, as well will post when I have succeeded.
On an alternate thought, as you have succesfully built the plugin for chronoforms to be displayed in an article{chronocontact}...any thoughts on having chronoconnectivity doing the same? this may be a simple solution to all solutions for pdf, print etc...
Take care legend!
This topic is locked and no more replies can be posted.