@ I Blog
Travel, Food & Me.

Opencart Adding Order Alert Email

Opencart Adding Order Alert Email.

At this current situation, there are many security implementation to most of the web hosting servers and possibly updated security in php mail() implementation. As so, many web hosting servers no longer allows simple php mail() function to work directly. You are required to set local server smtp email address in order to send emails from Opencart. Being said on this matter, external emails like Gmail, Yahoo, Hotmail, etc MAY not work in Opencart mail() function. You are forced to use internal email address SMTP configurations to email order confirmation to those additional email addresses.

Sending order confirmation to customer, however, using internal SMTP configuration is a non issue, all you have to do is set according to your web hosting provider server SMTP settings. The issue now is to send additional alert emails of your new orders. Apparently, sending additional email alerts are sent using php mail() as programmed by Opencart developers. Upon confirmation of orders, the emails in additional email alert settings will go silent and no emails are being sent out (maybe due to the security implementation as stated above).

So, there is an alternative work around by adding one recipient in “send to” email. To cut matter short, here is what I did by hard-coding one simple addition to this file.

This file is located at: “catalog\model\checkout\order.php”

Edit line number: 652

Original coded: $mail->setTo($order_info[’email’]);
Re-coding: $mail->setTo([$order_info[’email’],’sales@bizbit.com’]);

Now note the “bold” text as shown here: $mail->setTo([$order_info[’email’],’sales@bizbit.com’]); —> remember to add the “[” and “]” for it become an array in the setTO command. In my case, I added my other email into the setTO to ensure if my additional email alert fails, I should still be receiving the order confirmation via my added email address as stated.

Image below shows the addition in the file.

Note: The above alternative hard-coded method can be used in most Opencart versions. All you have to do is study and understand the coding and then make changes as required. Of course if you are having difficulties in the above adjustment, you can anytime comment below and I might be able to assist you.