Egocentralis
Member
Hello,
On the website we have a function to send group mails to employees, users or customers. I did a lot of rewrite and now its possible to send emails only to people who have the same company_id (bedrijf_id) of the logged in employee / user. So thats very good. This is created in a list element calc.
Now in the groupmail form there is a plugin php in where there is a lot of code to send the emails out in a good way. I was looking for a way to add a recipient email adress what should be the email address of the company (bedrijf_id) of the sender.
I did find this piece of code: "
// Maak een mailobject
$mailer = JFactory::getMailer();
// Voeg afzender, ontvanger, reply-to toe in het object
$mailer->addRecipient("somename@gmail.com");
$mailer->setSender($mail_van);
$mailer->addReplyTo('somename@gmail.com', "Stichting Jasper");
So when the email is sended and the receiver presses reply, then this address is showing in the receiver field of the email to send. In a fancy way as you can see at the enclosed image.
I wrote a query to grab the email and i want to put it in the $mailer fields. So :
$q = $db->getQuery(true);
$q
->select('email_adres_bedrijf')
->from('egocentralis_bedrijven')
->where('bedrijf_id IN (SELECT bedrijf_id FROM g4e_orakel_personeel WHERE userid = {$my->id})');
$db->setQuery($q);
$mails = $db->loadObjectList();
$mails should return the company email address of the logged in user.
$mailer = JFactory::getMailer();
// Voeg afzender, ontvanger, reply-to toe in het object
$mailer->addRecipient("return $mails");
$mailer->setSender($mail_van);
$mailer->addReplyTo('return $mails', "Stichting Jasper");
Unfortunately that is not working. So i tried to use "" and '' and () and [] but with no luck
How can i get the value of $mails into that position, or what for approach is better to use?
And if the php plugin in the form settings off the groupmail, cannot recognise the logged in user... how can i solve that matter??
Hopefully someone can point me in the good direction.
On the website we have a function to send group mails to employees, users or customers. I did a lot of rewrite and now its possible to send emails only to people who have the same company_id (bedrijf_id) of the logged in employee / user. So thats very good. This is created in a list element calc.
Now in the groupmail form there is a plugin php in where there is a lot of code to send the emails out in a good way. I was looking for a way to add a recipient email adress what should be the email address of the company (bedrijf_id) of the sender.
I did find this piece of code: "
// Maak een mailobject
$mailer = JFactory::getMailer();
// Voeg afzender, ontvanger, reply-to toe in het object
$mailer->addRecipient("somename@gmail.com");
$mailer->setSender($mail_van);
$mailer->addReplyTo('somename@gmail.com', "Stichting Jasper");
So when the email is sended and the receiver presses reply, then this address is showing in the receiver field of the email to send. In a fancy way as you can see at the enclosed image.
I wrote a query to grab the email and i want to put it in the $mailer fields. So :
$q = $db->getQuery(true);
$q
->select('email_adres_bedrijf')
->from('egocentralis_bedrijven')
->where('bedrijf_id IN (SELECT bedrijf_id FROM g4e_orakel_personeel WHERE userid = {$my->id})');
$db->setQuery($q);
$mails = $db->loadObjectList();
$mails should return the company email address of the logged in user.
- I am not totally sure, if the php in the form, will notice that for example I am the logged in User. The list on the frontend notice it. Does the php notice its the logged in user?
$mailer = JFactory::getMailer();
// Voeg afzender, ontvanger, reply-to toe in het object
$mailer->addRecipient("return $mails");
$mailer->setSender($mail_van);
$mailer->addReplyTo('return $mails', "Stichting Jasper");
Unfortunately that is not working. So i tried to use "" and '' and () and [] but with no luck
How can i get the value of $mails into that position, or what for approach is better to use?
And if the php plugin in the form settings off the groupmail, cannot recognise the logged in user... how can i solve that matter??
Hopefully someone can point me in the good direction.