Post by pixelhaus » Tue Jan 22, 2019 12:49 am

When an order is placed, the customer gets an email confirmation. I'd like to send a Bcc of that email to admin or a nominated address. Is there an easy way to do that ?

New member

Posts

Joined
Mon Sep 26, 2011 3:57 pm

Post by Johnathan » Tue Jan 22, 2019 2:34 am

I think this still works, though I haven't tested it in a long time. If it doesn't, take a look at the file and the edit it makes, and then look at the mail.php file in OpenCart 3.0, and you should be able to figure out where the edit goes.

viewtopic.php?f=131&t=27531

Image Image Image Image Image


User avatar
Administrator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by pixelhaus » Wed Jan 23, 2019 12:06 am

Thanks for that. I edited system/library/mail/mail.php
and inserted the 4th line (email address changed). Does that look right to you ?

Code: Select all

                $header  = 'MIME-Version: 1.0' . PHP_EOL;
		$header .= 'Date: ' . date('D, d M Y H:i:s O') . PHP_EOL;
		$header .= 'From: =?UTF-8?B?' . base64_encode($this->sender) . '?= <' . $this->from . '>' . PHP_EOL;
                $header .= 'Bcc: xxxxxxxxxxx@xxxxxxxxxx.co.uk' . PHP_EOL;
		
		if (!$this->reply_to) {
			$header .= 'Reply-To: =?UTF-8?B?' . base64_encode($this->sender) . '?= <' . $this->from . '>' . PHP_EOL;
		} else {
			$header .= 'Reply-To: =?UTF-8?B?' . base64_encode($this->reply_to) . '?= <' . $this->reply_to . '>' . PHP_EOL;
		}

New member

Posts

Joined
Mon Sep 26, 2011 3:57 pm

Post by Johnathan » Wed Jan 23, 2019 10:32 pm

Yes, it looks right to me.

Image Image Image Image Image


User avatar
Administrator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by pixelhaus » Tue Jan 29, 2019 10:35 pm

Unfortunately that's not working for us. Are there any extensions that might do this ? To recap, I need send a bcc of the order add email (the one the customer gets) to a specified address. ie admin.

New member

Posts

Joined
Mon Sep 26, 2011 3:57 pm

User avatar
Expert Member

Posts

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

Post by Johnathan » Tue Jan 29, 2019 11:29 pm

Make sure you refresh your ocMod cache in Extensions > Modifications, in case some other file is modifying that same file. If that doesn't fix it, try this edit:

Code: Select all

IN:
/system/library/mail/mail.php

AFTER:
$header .= 'From: =?UTF-8?B?' . base64_encode($this->sender) . '?= <' . $this->from . '>' . PHP_EOL;

ADD:
$email = 'your@email.com';
$header .= 'Bcc: =?UTF-8?B?' . base64_encode($email) . '?= <' . $email . '>' . PHP_EOL;

Image Image Image Image Image


User avatar
Administrator

Posts

Joined
Fri Dec 18, 2009 3:08 am

Who is online

Users browsing this forum: Bing [Bot] and 13 guests