1. itadminguy
  2. General
  3. Thursday, July 06 2017, 04:53 AM
Hello. I have managed to get the Update User Profile plugin to send out an email to the email address (to admin email) typed into the plugin.

Is there a way to also send to the user and even additional email address fields in the profile e.g. email (default user email), customemail2 (another field in the profile), customemail3 (another field in the profile)

Here is part of the php for the plugin. Can the additional email fields (default user email, customemail2, customemail3) be added here to send out additional emails?

In addition to sending out to admin email typed into the plugin, it would be nice to also send to user default email and additional custome emails.

I tried to add here but it did not work:

$this->params->get('email','customeemail2','customeemail3',''), // Receiver Mail

Thanks in advance

**************************



public function triggerProfileUpdate($user, &$data, $changed, $isNew)
{
if(!$isNew)
{
// Start body of email
$body=$user->name." updated his profile. \n\n";

// Add fields to body email
foreach($changed as $fieldalias){
$body.=$fieldalias .": ". $data[$fieldalias] ."\n";
}
//die($this->params->get('email',''));
// Send Email
$result=JFactory::getMailer()->sendMail(
$user->email, // Sender Mail
$user->name, // Sender Name
$this->params->get('email',''), // Receiver Mail
'Profile Updated', // Subject Mail
$body // Body Mail
);
}
admin Accepted Answer
Admin
Hi,
sorry but we does not support custom code, anyway some tip for you:
$this->params->get('email','customeemail2','customeemail3',''), // Receiver Mail
this is totally wrong, you should use something like
array( $data['email'], $data['customeemail2'], $data['customeemail3'] ), // Receiver Mail

in function getMailer->sendMail you can use array to add multiple receivers.

Keep in mind that if there is an error or empty email then entire function JFactory::getMailer()->sendMail will not work, so you should check that variables in $data array are filled.

NOTE: this code is not tested and not supported, this is only for example purpose.
  1. more than a month ago
  2. General
  3. # 1
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.