Hi,
I need a good idea...
I'm trying to "translate" an old Joomla component (written by somebody who left our house) into CF and CC.
One functionality is that by clicking a button a PC mail program (Outlook, Thunderbird etc) was started to send a mail to all members of a special group.
(I hope) I will be able to get those members data via a SQL query, but - how do I get the mail program running via CF ?
The Email action does not help because the message content is not predictable...
Thanks for any idea,
Doris
I need a good idea...
I'm trying to "translate" an old Joomla component (written by somebody who left our house) into CF and CC.
One functionality is that by clicking a button a PC mail program (Outlook, Thunderbird etc) was started to send a mail to all members of a special group.
(I hope) I will be able to get those members data via a SQL query, but - how do I get the mail program running via CF ?
The Email action does not help because the message content is not predictable...
Thanks for any idea,
Doris
Hi Doris,
You can use variables in the Email template - in fact you can make the whole template a variable like {email_template} and build the contents you want in $form->data['email_templates']
This won't work if you need to send different emails to different people at the same time though (but neither would linking to Outlook).
My Email [GH] action will send emails to an array of To Email addresses (and will send separate emails if needed).
But if you have more than, maybe 40 or 50 to send it might be better to use one of the Joomla! Email extensions that will manage the flow of emails better.
Bob
You can use variables in the Email template - in fact you can make the whole template a variable like {email_template} and build the contents you want in $form->data['email_templates']
This won't work if you need to send different emails to different people at the same time though (but neither would linking to Outlook).
My Email [GH] action will send emails to an array of To Email addresses (and will send separate emails if needed).
But if you have more than, maybe 40 or 50 to send it might be better to use one of the Joomla! Email extensions that will manage the flow of emails better.
Bob
Hi Bob,
thanks for the reply.
It would be ONE same mail to all group members, but - the secretary who will use the form is used to work with Outlook, so the form should switch somehow - if possible - to Outlook so that the secretary can enter the mail text there and send it from there.
Doris
thanks for the reply.
It would be ONE same mail to all group members, but - the secretary who will use the form is used to work with Outlook, so the form should switch somehow - if possible - to Outlook so that the secretary can enter the mail text there and send it from there.
Doris
Hi Doris,
Sounds like a long way round - you could try building a mailto: including all the addresses.
Bob
Sounds like a long way round - you could try building a mailto: including all the addresses.
Bob
I solved it - exactly in the way I wanted the form to behave...
In the form code I have a button with a JS call:
In the On Load action of the form I have a Custom Code action which includes a php file:
And in the php file I have a nice combination of php and JS getting the Email addresses via mySQL calling my local mail program
(To be honest - the code above was written by the programmer who left us - I just had to find a way to build it into my form...)
Doris
In the form code I have a button with a JS call:
<input name="Schalter" id="Schalter" class="" value="Mail" type="button" onClick="sendMail ();" />
In the On Load action of the form I have a Custom Code action which includes a php file:
<?php
include (JPATH_SITE.DS.'components'.DS.'com_chronoforms'.DS.'includes'.DS.'FBR'.DS.'sendMail.php');
?>
And in the php file I have a nice combination of php and JS getting the Email addresses via mySQL calling my local mail program
<?php
defined('_JEXEC')or die('Restricted access'); ?>
<script language="javascript" type="text/javascript">
var memberIDs = new Array();
var memberArray = new Array();
memberArray[0] = new Object();
memberArray[1] = new Object();
<?php
$db =& JFactory::getDBO();
$query = "Select U.id, U.name, U.email from ...; ";
$db->setQuery($query);
$data = $db->loadAssocList();
// Alle Namen und Emailadressen umsetzen
$count = 0;
foreach ( $data as $d ){
echo 'memberIDs[' .$count .']' . '= "' .$d['id'] .'";';
echo 'memberArray[0]["' .$count .'"] = "';
echo $d[email];
echo '"; ';
echo ' memberArray[1]["' .$count .'"] = "';
echo $d['name']);
echo '"; ';
$count = $count + 1;
}
?>
function sendMail(){
// SET MESSAGE VALUES
var cc = "";
for (i = 0; i < memberIDs.length; i++){
cc = cc + memberArray[1][i] + "<" + memberArray[0][i] + ">";
cc = cc + ", ";
}
var subject = " ";
var body =
"\n" +
"\n" +
"\n" +
"\n\n";
var doc = "mailto:" +
"?cc=" + cc +
" &subject=" + escape(subject) +
" &body=" + escape(body);
window.location = doc;
}
</script>
(To be honest - the code above was written by the programmer who left us - I just had to find a way to build it into my form...)
Doris
This topic is locked and no more replies can be posted.