Page 1 of 2
BCC E-mail Notifications to Shop Address
Posted: Sun Sep 23, 2007 3:38 am
by d77
i posted this in the forum earlier, but it needs a better home here.
when a customer completes a purchase, they receive an email containing the order details. this mod sends a "blind carbon copy" of that email to the shop admin email address.
hopefully we will see this or a similar change integrated into the core opencart product. i feel it would be really useful as a configurable feature.
instructions are included in install.txt
works with opencart 0.7.6.1
Re: BCC E-mail Notifications to Shop Address
Posted: Fri Sep 28, 2007 11:09 pm
by ytr
Thank you, it is very helpful
And in accordance I have a question:
How can I set Newsletter that subscribers will not see all their e-mails?
See you
Re: BCC E-mail Notifications to Shop Address
Posted: Fri Sep 28, 2007 11:39 pm
by d77
i never got to test this behavior, but my assumption is that the newsletter correspondence will also have this issue.
i'm guessing all recipients of the newsletter are going to be able to see everyone else's e-mail address in the TO list, which is NOT what we want in any type of mass mailing. i think the change i supplied to support BCC is part of the solution, but the newsletter script needs to change to use BCC instead of TO.
shouldn't be too hard... but the problem is, who goes in the TO field? maybe the shop address? i'm not sure this is how major mailing list scripts work. any advice here would be appreciated.
Re: BCC E-mail Notifications to Shop Address
Posted: Sun Sep 30, 2007 4:57 pm
by ytr
In admin/controller/newsletter.php
I've change line
$mail->setTo($email);
to
$mail->setBcc($email);
but I doesn't work and there appears - "Error: To not set"
Of course I've got in library/mail/mail.php Bcc support (as in attachment)
Any suggestions?
Re: BCC E-mail Notifications to Shop Address
Posted: Sun Sep 30, 2007 6:21 pm
by luvz2drv
To should pull from the shop email... then send out... BCC to the rest
that is kinda a logic way of doing it.
or get all email address and send them 1 at a time...
looping thru
not so effeint
Re: BCC E-mail Notifications to Shop Address
Posted: Sun Sep 30, 2007 8:55 pm
by d77
ytr - you've got the basic idea, but an email still needs a "TO" address. my thought was to put the shop address in the TO field, and BCC all the customers. try this:
Code: Select all
$mail->setTo($config->get('config_email'));
$mail->setBcc($email);
why is mail.php attached? is this any different from the mail.php attached in my mod zip?
Re: BCC E-mail Notifications to Shop Address
Posted: Mon Oct 01, 2007 4:29 pm
by ytr
d77 - thanks
code
$mail->setTo($config->get('config_email'));
$mail->setBcc($email);
works
mail.php I've attached is yours

Re: BCC E-mail Notifications to Shop Address
Posted: Sun Jan 06, 2008 5:41 pm
by cah
Thank you d77!
This is very helpful. However, after I changed the store language, the BCC e-mail is not sent to the store owner address, it is sent to the customer twice instead. How should I fix this?
BCC order email to admin? (Mod not working)
Posted: Tue Jun 03, 2008 2:21 am
by Kimmiekins
I've been trying to get the BCC to admin mod working, and not having any luck. I AM receiving the order email from OC as the customer, so the mail server isn't the problem and the mail script is working fine otherwise. I have done everything listed here:
http://forum.opencart.com/index.php/topic,427.0.html
Multiple times, and still not getting the BCC email to the admin after an order.
I need this working for this particular (my first setup with OC - love it!), as my client is not the most web-savy and would be better off reading emails with the order than going into the system itself (someone else will be updating the status of the orders).
Anyone? Thanks in advance!
Re: BCC E-mail Notifications to Shop Address
Posted: Tue Jun 03, 2008 1:05 pm
by bruce
I hate to ask, but have you put a value in the email address field of the mail tab in your store admin?
If yes, could you please post the contents of your Mail.php for us to review?
Re: BCC E-mail Notifications to Shop Address
Posted: Wed Jun 04, 2008 11:35 pm
by lev
To administer email server settings and carbon copy to store manager:
apply the changes in the zip to:
/admin/controller/settings.php
/admin/language/english/controller/setting.php
/library/mail/mail.php
to send mail (like in admin/controller/mail.php) simply use
Code: Select all
if ($email) {
$mail->setTo('Confidential Recipients <' .$config->get('config_email').'>');
$mail->setCc($config->get('config_email_cc'));
$mail->setBcc($email);
$mail->setFrom($config->get('config_email'));
$mail->setSender($config->get('config_store'));
$mail->setSubject($request->get('subject', 'post'));
$mail->setHtml($request->get('content', 'post'));
$mail->send();
}
This will send an email out to your client without exposing other emails (in case of newsletter), send to your email as the to, and will let you specify through your admin panel (under Admin->Configuration->Setting Mail tab) if a carbon copy is needed!
Re: BCC E-mail Notifications to Shop Address
Posted: Tue Jun 24, 2008 2:25 am
by jamble
Hi Guys,
I've tried getting this working and had no luck, newsletters are still coming through with all customers emails in the To: field.
I've updated the 3 files in the zip and my admin/mail/mail.php file to include the snippet above from Lev but nothing appears to have changed when I send newsletters.
I've attached my admin/mail/mail.php file here if anyone could see if anything is missing/incorrect?
I have set a mail in my store config for the site so it's not missing that info.
Thanks!
Re: BCC E-mail Notifications to Shop Address
Posted: Wed Jun 25, 2008 9:24 am
by gibpat
I too seem to be having troubles...
Ive followed Lev's instructions but still no luck, i dont have a bcc option in settings -> mail and admin doesnot receive a copy of order.
Anyone got any ideas?
Re: BCC E-mail Notifications to Shop Address
Posted: Wed Jun 25, 2008 10:39 pm
by bruce
There are two locations to change in admin\controller\newsletter.php
The first is in the insert() function, the second in the update() function.
Re: BCC E-mail Notifications to Shop Address
Posted: Thu Jun 26, 2008 12:18 pm
by gibpat
bruce wrote:
There are two locations to change in admin\controller\newsletter.php
The first is in the insert() function, the second in the update() function.
Have done this thanks bruce, any ideas how to get the bcc option into my admin panel? Admin still does not receive order email...
Re: BCC E-mail Notifications to Shop Address
Posted: Thu Jun 26, 2008 2:22 pm
by bruce
and library\cart\order.php has been modified to look as follows?
Code: Select all
if ($this->config->get('config_email_send'))
{
$this->mail->setTo($this->data['email']);
$this->mail->setBcc($this->config->get('config_email'));
$this->mail->setFrom($this->config->get('config_email'));
$this->mail->setSender($this->config->get('config_store'));
$this->mail->setSubject($this->data['email_subject']);
$this->mail->setText($this->data['email_text']);
$this->mail->setHtml($this->data['email_html']);
$this->mail->send();
}
Re: BCC E-mail Notifications to Shop Address
Posted: Fri Jun 27, 2008 10:01 pm
by lev
Guys,
I apologize for leaving you hanging for so long... I see there are questions... I will try to answer as best as I can.
Please let me know the specifics of your difficulties (Admin panel settings does not show email server settings, all looks fine but email is never sent to bcc recepients, excetra... i will ensure we get you guys working

Re: BCC E-mail Notifications to Shop Address
Posted: Fri Jun 27, 2008 10:08 pm
by lev
jamble,
It looks like your code changes are good, you just need to change the code in /admin/controller/newsletter.php!
Currently, you have this around line 51 of that file for the insert finction and line 104 for the update function (AS BRUCE SAID, BOTH MUST BE CHANGED)! :
Code: Select all
if ($email) {
$mail->setTo($email);
$mail->setFrom($config->get('config_email'));
$mail->setSender($config->get('config_store'));
$mail->setSubject($request->get('subject', 'post'));
$mail->setHtml($request->get('content', 'post'));
$mail->send();
}
change the code to use the suggested settings (read brunces latest post) and you will be golden

Re: BCC E-mail Notifications to Shop Address
Posted: Fri Jun 27, 2008 10:11 pm
by lev
Gibpat,
If you do not see the email server settings in your admin panel, ensure
The code changes i included for the /admin/controler/settings.php, admin/language/english/controller/setting.php and admin/template/default/controller/setting.php have all been applied!!
Re: BCC E-mail Notifications to Shop Address
Posted: Mon Jun 30, 2008 1:12 pm
by gibpat
lev wrote:
Gibpat,
If you do not see the email server settings in your admin panel, ensure
The code changes i included for the /admin/controler/settings.php, admin/language/english/controller/setting.php and admin/template/default/controller/setting.php have all been applied!!
I must be going blind, i cannot find any instructions for admin/template/default/controller/setting.php, should i be looking elsewhere?