Skip to content

Commit

Permalink
CC and BCC fields in the global mail settings
Browse files Browse the repository at this point in the history
  • Loading branch information
vaivk369 committed Feb 7, 2019
1 parent 50ed6e9 commit 8afeda8
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 0 deletions.
22 changes: 22 additions & 0 deletions administrator/components/com_config/forms/application.xml
Expand Up @@ -470,6 +470,28 @@
showon="mailonline:1"
/>

<field
name="mailcc"
type="email"
label="COM_CONFIG_FIELD_MAIL_ADD_CC_LABEL"
description="COM_CONFIG_FIELD_MAIL_ADD_CC_DESC"
filter="string"
size="30"
validate="email"
showon="mailonline:1"
/>

<field
name="mailbcc"
type="email"
label="COM_CONFIG_FIELD_MAIL_ADD_BCC_LABEL"
description="COM_CONFIG_FIELD_MAIL_ADD_BCC_DESC"
filter="string"
size="30"
validate="email"
showon="mailonline:1"
/>

<field
name="mailer"
type="list"
Expand Down
4 changes: 4 additions & 0 deletions administrator/language/en-GB/en-GB.com_config.ini
Expand Up @@ -71,6 +71,10 @@ COM_CONFIG_FIELD_MAIL_FROM_EMAIL_LABEL="From Email"
COM_CONFIG_FIELD_MAIL_FROM_NAME_LABEL="From Name"
COM_CONFIG_FIELD_MAIL_REPLY_TO_EMAIL_LABEL="Reply To Email"
COM_CONFIG_FIELD_MAIL_REPLY_TO_NAME_LABEL="Reply To Name"
COM_CONFIG_FIELD_MAIL_ADD_CC_LABEL="Add CC"
COM_CONFIG_FIELD_MAIL_ADD_CC_DESC="The email is copied to set email address"
COM_CONFIG_FIELD_MAIL_ADD_BCC_LABEL="Add BCC"
COM_CONFIG_FIELD_MAIL_ADD_BCC_DESC="Email is blind carbon copied to the set email address"
COM_CONFIG_FIELD_MAIL_MAILONLINE_LABEL="Send Mail"
COM_CONFIG_FIELD_MAIL_MASSMAILOFF_LABEL="Disable Mass Mail"
COM_CONFIG_FIELD_MAIL_MAILER_LABEL="Mailer"
Expand Down
2 changes: 2 additions & 0 deletions installation/configuration.php-dist
Expand Up @@ -83,6 +83,8 @@ class JConfig
public $massmailoff = '0';
public $replyto = '';
public $replytoname = '';
public $mailcc = '';
public $mailbcc = '';
public $sendmail = '/usr/sbin/sendmail';
public $smtpauth = '0';
public $smtpuser = '';
Expand Down
16 changes: 16 additions & 0 deletions libraries/src/Mail/Mail.php
Expand Up @@ -640,11 +640,27 @@ public function sendMail($from, $fromName, $recipient, $subject, $body, $mode =
return false;
}

if ($app->get('mailcc'))
{
if ($this->addCc($app->get('mailcc')) === false)
{
return false;
}
}

if ($this->addBcc($bcc) === false)
{
return false;
}

if ($app->get('mailbcc'))
{
if ($app->addBcc($app->get('mailbcc')) === false)
{
return false;
}
}

if ($this->addAttachment($attachment) === false)
{
return false;
Expand Down

0 comments on commit 8afeda8

Please sign in to comment.