Hello,
I am a beginner in both Chronoforms and php/mysql
I wrote a php code to select emails resulting from a mysql query. The purpose is to let merchants send emails on my website to customers who put them as favorites.
The code is working. I tested it with a <form></form> in a K2 item with an external php file. In it i used $mailer =& JFactory::getMailer(); to send the mails with success.
here is the code :
$user =& JFactory::getUser();
$u_id = $user->id;
$db =& JFactory::getDBO();
$query1 = "SELECT name FROM jooml_users WHERE id=".$db->quote($u_id).";";
$db->setQuery($query1);
$result1 = $db->loadResult();
$sql = "SELECT note FROM jooml_cdfapa WHERE title='".$result1."';";
$result = mysql_query($sql);
$to = array();
while (($row = mysql_fetch_assoc($result))!=null){
$to[] = $row['note'];
}
The problem is i don't know how to use the result ($to) in my chronoforms send mail.
Thanks in advance
http://imageshack.us/photo/my-images/841/18852177.jpg/
http://imageshack.us/photo/my-images/829/49277908.jpg/
(I think to one more thing. How many mails can send a merchant with such a system. Will it be possible to store emails with messages in a database and write a script to send them not at the same time ?)
I am a beginner in both Chronoforms and php/mysql
I wrote a php code to select emails resulting from a mysql query. The purpose is to let merchants send emails on my website to customers who put them as favorites.
The code is working. I tested it with a <form></form> in a K2 item with an external php file. In it i used $mailer =& JFactory::getMailer(); to send the mails with success.
here is the code :
$user =& JFactory::getUser();
$u_id = $user->id;
$db =& JFactory::getDBO();
$query1 = "SELECT name FROM jooml_users WHERE id=".$db->quote($u_id).";";
$db->setQuery($query1);
$result1 = $db->loadResult();
$sql = "SELECT note FROM jooml_cdfapa WHERE title='".$result1."';";
$result = mysql_query($sql);
$to = array();
while (($row = mysql_fetch_assoc($result))!=null){
$to[] = $row['note'];
}
The problem is i don't know how to use the result ($to) in my chronoforms send mail.
Thanks in advance
http://imageshack.us/photo/my-images/841/18852177.jpg/
http://imageshack.us/photo/my-images/829/49277908.jpg/
(I think to one more thing. How many mails can send a merchant with such a system. Will it be possible to store emails with messages in a database and write a script to send them not at the same time ?)
Hi hares7293,
First, I'm not certain that you can easily get a ChronoForms to run in K2. There are other threads here about that question.
To make your data available to the ChronoForms Email action add it to the $form->data array e.g.
But you still have some problems, I don't think that the standard Email action supports array values in the To box (though it may), it certainly doesn't support sending individual emails when there is more than one To address which is what you need here. My custom Email [GH] action does support both of these so could technically do what you need.
It would work OK for a a few emails in the tens or maybe a hundred or so. If you want to send more than this you might well hit time-out problems - I've never tried more than a handful. You might be better looking at one of the custom mailer extensions like JNews, or even an external mail service like Campaign Monitor. These have much better email management than you can get into ChronoForms without a lot of work.
The reason for suggesting an External service is that you run a risk if you send bulk emails from your own domain and start getting spam reports that your domain may be black-listed or blocked. Using an external mail service avoids this risk. Only you and your client can work out wha the risk is though :-(
Bob
First, I'm not certain that you can easily get a ChronoForms to run in K2. There are other threads here about that question.
To make your data available to the ChronoForms Email action add it to the $form->data array e.g.
$form->data['to'] = $to;
But you still have some problems, I don't think that the standard Email action supports array values in the To box (though it may), it certainly doesn't support sending individual emails when there is more than one To address which is what you need here. My custom Email [GH] action does support both of these so could technically do what you need.
It would work OK for a a few emails in the tens or maybe a hundred or so. If you want to send more than this you might well hit time-out problems - I've never tried more than a handful. You might be better looking at one of the custom mailer extensions like JNews, or even an external mail service like Campaign Monitor. These have much better email management than you can get into ChronoForms without a lot of work.
The reason for suggesting an External service is that you run a risk if you send bulk emails from your own domain and start getting spam reports that your domain may be black-listed or blocked. Using an external mail service avoids this risk. Only you and your client can work out wha the risk is though :-(
Bob
Thanks a lot, i managed to use your email action with success. I will keep this solution for the moment (just a few merchants and customers)
The only problem (i don't know why), after processing the form it says :
Adresse invalide: Adresse invalide: (invalid address for each mail address but i receive them)
thanks
The only problem (i don't know why), after processing the form it says :
Adresse invalide: Adresse invalide: (invalid address for each mail address but i receive them)
thanks
Hi hares7293,
I think that the "Invalid address:" message come up in a couple of circumstances:
a) If the From Email Address in the Email action doesn't match the Admin address in the Site email configuration.
b) It there is a missing or broken From Email address (or possibly Reply To Email address).
Bob
I think that the "Invalid address:" message come up in a couple of circumstances:
a) If the From Email Address in the Email action doesn't match the Admin address in the Site email configuration.
b) It there is a missing or broken From Email address (or possibly Reply To Email address).
Bob
This topic is locked and no more replies can be posted.