Post by genegrin » Wed Oct 31, 2018 10:15 pm

I'd like to receive customer's messages to two email addresses.
How can I add an addition email address to a contact form? Please advise to me.
Version 1.5.4.
Thank you.

Active Member

Posts

Joined
Wed Jun 08, 2011 3:00 am

Post by Johnathan » Thu Nov 01, 2018 12:08 am

OpenCart doesn't have a setting for that in 1.5.4, but try this edit to hard-code the second e-mail address:

Code: Select all

IN:
/catalog/controller/information/contact.php

BEFORE:
$this->redirect($this->url->link('information/contact/success'));

ADD:
$mail->setTo('your@email.com');
$mail->send();

Image
Image Image Image Image


User avatar
Global Moderator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by Cleo » Thu Nov 01, 2018 3:24 am

I am using v1.5.4.1 and if someone use the contact form or if I make a sale, etc. I always get an email in my mail@mysite.com and a copy to my gmail.com, I am using imap maybe that's why?

Cleo

My EN Store
My FR Store
Opencart v1.5.4.1 fr/en
Theme: Custom
vqmod-2.6.0


User avatar
Active Member

Posts

Joined
Wed Mar 09, 2011 5:19 am

Post by genegrin » Fri Nov 02, 2018 2:22 am

Johnathan wrote:
Thu Nov 01, 2018 12:08 am
OpenCart doesn't have a setting for that in 1.5.4, but try this edit to hard-code the second e-mail address:

Code: Select all

IN:
/catalog/controller/information/contact.php

BEFORE:
$this->redirect($this->url->link('information/contact/success'));

ADD:
$mail->setTo('your@email.com');
$mail->send();
Johnathan, when I add that code, it shows this.
Notice: Error: E-Mail from required! in /home3/mysite/public_html/system/library/mail.php on line 56

Active Member

Posts

Joined
Wed Jun 08, 2011 3:00 am

Post by genegrin » Sun Nov 04, 2018 12:27 am

Really strange that it can only be 1 store owner's email. Even this small defect costs money and time.

Active Member

Posts

Joined
Wed Jun 08, 2011 3:00 am

Post by straightlight » Sun Nov 04, 2018 12:49 am

genegrin wrote:
Sun Nov 04, 2018 12:27 am
Really strange that it can only be 1 store owner's email. Even this small defect costs money and time.
Change Management is about money and time. If no expense would need to be done for anything at all, no changes would be required.

The most generated errors being found on Opencart forum originates from contributed programming. The increased counters are caused by posted redundancies of the same solutions that were already provided prior.

F. Rules:

- viewtopic.php?f=176&t=200480
- viewtopic.php?f=176&t=200804


Regards,
Straightlight


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by Johnathan » Sun Nov 04, 2018 3:27 am

genegrin wrote:
Fri Nov 02, 2018 2:22 am
Johnathan, when I add that code, it shows this.
Notice: Error: E-Mail from required! in /home3/mysite/public_html/system/library/mail.php on line 56
Are you absolutely sure you did it right? The "From" value should already be set from the previous mail value settings. I haven't specifically tested this in 1.5.4, but I use similar syntax in some of my extensions, so I believe it should work fine. Try doing the edit again, and make sure you're setting that code right before the "redirect" line, and not anywhere else.

If it still doesn't work after that, you can also set the "From" value again, though it shouldn't be necessary. You'd do that by adding this line before the "$mail->send()" line:

Code: Select all

$mail->setFrom($this->request->post['email']);

Image
Image Image Image Image


User avatar
Global Moderator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by genegrin » Sun Nov 04, 2018 11:36 pm

Johnathan, this is a part of my current code below. When I change an email address there, emails don’t come in.
When I add these lines:
$mail->setTo('myemail2@gmail.com');
$mail->send();


CODE:
$mail->setTo('mystore@gmail.com');
$mail->setFrom($this->request->post['email']);
$mail->setSender($this->request->post['name']);
$mail->setSubject(html_entity_decode(sprintf($this->language->get('email_subject'), $this->request->post['name']), ENT_QUOTES, 'UTF-8'));
$mail->setText(strip_tags(html_entity_decode($this->request->post['enquiry'], ENT_QUOTES, 'UTF-8')));
$mail->send();

$this->redirect($this->url->link('information/contact/success'));

Active Member

Posts

Joined
Wed Jun 08, 2011 3:00 am

Post by Johnathan » Mon Nov 05, 2018 10:36 pm

You did the edit wrong. You need to ADD the new lines, not REPLACE the old lines with the new lines. Do the edit exactly as I described (add the new lines right before the line I mentioned), and it will work.

Image
Image Image Image Image


User avatar
Global Moderator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by genegrin » Tue Nov 06, 2018 9:16 pm

Johnathan,
1.
If this CODE:
$mail->setTo('myemail2@gmail.com');
$mail->send();
$mail->setTo('mystore@gmail.com');
$mail->setFrom($this->request->post['email']);
$mail->setSender($this->request->post['name']);
$mail->setSubject(html_entity_decode(sprintf($this->language->get('email_subject'), $this->request->post['name']), ENT_QUOTES, 'UTF-8'));
$mail->setText(strip_tags(html_entity_decode($this->request->post['enquiry'], ENT_QUOTES, 'UTF-8')));
$mail->send();
$this->redirect($this->url->link('information/contact/success'));

Notice: Error: E-Mail from required! in /home3/mysite/public_html/system/library/mail.php on line 56.
2.
And messages don’t arrive me if this CODE:
$mail->setTo('mystore@gmail.com');
$mail->setFrom($this->request->post['email']);
$mail->setSender($this->request->post['name']);
$mail->setSubject(html_entity_decode(sprintf($this->language->get('email_subject'), $this->request->post['name']), ENT_QUOTES, 'UTF-8'));
$mail->setText(strip_tags(html_entity_decode($this->request->post['enquiry'], ENT_QUOTES, 'UTF-8')));
$mail->send();
$mail->setTo('myemail2@gmail.com');
$mail->send();
$this->redirect($this->url->link('information/contact/success'));

Active Member

Posts

Joined
Wed Jun 08, 2011 3:00 am

Post by Johnathan » Tue Nov 06, 2018 10:46 pm

The edited code of #2 would be correct. I just tested this and it works fine for me, so if it doesn't work for you then there may be something else wrong in your installation. I'm not sure what else to suggest, so you may need to hire someone to look at this for you.

If you need to find a developer, you should post a request in the OpenCart "Commercial Support" forum, which is checked by a number of OpenCart developers. You can also try checking out the OpenCart "Partners" area.

Image
Image Image Image Image


User avatar
Global Moderator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by straightlight » Wed Nov 07, 2018 5:17 am

Check your server logs after testing those possibilities. One of the methods being used might be rejected by the EHLO response.

The most generated errors being found on Opencart forum originates from contributed programming. The increased counters are caused by posted redundancies of the same solutions that were already provided prior.

F. Rules:

- viewtopic.php?f=176&t=200480
- viewtopic.php?f=176&t=200804


Regards,
Straightlight


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON
Who is online

Users browsing this forum: No registered users and 32 guests