Post by siteadvice » Tue Nov 30, 2021 8:28 pm

I have tried following instructions found on the forum and elsewhere to add a BCC to outbound mail using Opencart 2.0.2.0 with WHM/cPanel on CENTOS 7.9, but it does not work for me and I wondered if anyone had any suggestions.

I also tried using CC just in case the issue was with BCC and that didn't help.

This is the method I am using.

First I edited /system/library/mail.php

After public $parameter = ''; I added:

Code: Select all

protected $bcc;
After public function setTo($to) {$this->to = $to;} I added

Code: Select all

public function setBcc($bcc) {
	$this->bcc = $bcc;
	}
After $header .= 'To: ' . $to . $this->newline; I added:

Code: Select all

if ($this->bcc) {
		$header .= 'Bcc: ' . $this->bcc . $this->newline;
		}
Then I edited /catalog/model/checkout/order.php

After $mail->setTo($order_info['email']); I added:

Code: Select all

$mail->setBcc('redacted_email_address');
(Just to be clear, I put a real email address in there!)

I then refreshed modifications and cleared the VQMOD cache but when I send an email update, there is no BCC. I also tried it with CC and again it's not being done.

The email is being sent, but there is no BCC.

There is no error on screen when sending the email notification. I have checked /system/logs/error_log as well as the error_log file in the root and there's nothing showing there.

I wondered if maybe email was being sent by some other method, so in /library/mail.php I temporarily hard-coded my email address in public function setTo($to) and tested it, which generated an email to me. So it's definitely using that file, but it is ignoring CC and BCC.

I have tried this on my development server and also on my live server and neither is working.

I have successfully tested sending BCC email via a regular SMTP connection on the same server and just to be sure I sent an email via BCC using a Wordpress form on the same server. So I am pretty sure that the issue is Opencart and not the mail server.

As you can see if you've read this far, I have tried a lot of things before reaching out to the community for help!

Does anyone have any ideas?

inframes.com Website Design with Opencart, Wordpress, Lucee and bespoke application design and development


User avatar
New member

Posts

Joined
Mon Oct 24, 2011 8:12 pm

Post by xxvirusxx » Tue Nov 30, 2021 9:14 pm

You want to send e-mail to other e-mails addresses when a customer make an order?

Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by siteadvice » Wed Dec 01, 2021 1:43 am

I managed to find a solution for this. Possibly it's not great, but I haven't been able to find any problems with it so far.

I had a copy of Opencart 2.0.1.1 running on the same server and I tried the above code on that site and it worked perfectly.

So, I have just taken the whole of the mail.php file from Opencart 2.0.1.1 and replaced the copy of mail.php in Opencart 2.0.2.0.

I'm not 100% comfortable with this as a solution, but it seems to work fine!

If anyone has any better ideas, let me know.

inframes.com Website Design with Opencart, Wordpress, Lucee and bespoke application design and development


User avatar
New member

Posts

Joined
Mon Oct 24, 2011 8:12 pm

Post by siteadvice » Wed Dec 01, 2021 1:45 am

xxvirusxx wrote:
Tue Nov 30, 2021 9:14 pm
You want to send e-mail to other e-mails addresses when a customer make an order?
That's correct. Well, actually when an order status is updated, but you get the idea. However, it must be by BCC. It's not suitable in this case to add To addresses.

inframes.com Website Design with Opencart, Wordpress, Lucee and bespoke application design and development


User avatar
New member

Posts

Joined
Mon Oct 24, 2011 8:12 pm

Post by paulfeakins » Wed Dec 01, 2021 6:48 pm

siteadvice wrote:
Wed Dec 01, 2021 1:43 am
If anyone has any better ideas, let me know.
I'm sure there used to be an extension for this - have you looked?

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Guru Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom
Who is online

Users browsing this forum: Baidu [Spider] and 66 guests