Page 1 of 1

not getting emails from contact us page opencart 2.0.3.1

Posted: Tue Jan 09, 2018 7:01 pm
by reynafabrics
Hi,
My site running on 2.0.3.1 version. I am having issue with email notification. I am not getting notification emails while sign up, order confirmation etc.
I have done general R&D like
1) Mail/SMTP configuration with and without -f parameters SMTP Port.
2) Checked for both Gmail account and personal domain account
3) Set email as registered email for sending mails via scripts (hostgator)
4) Added code sendmail_path = /usr/sbin/sendmail -t -i; in root and admin php.ini file

Then I changed,

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

from system/library/mail.php

//$header .= 'From: =?UTF-8?B?' . base64_encode($this->sender) . '?=' . ' <' . $this->from . '>' . $this->newline;
$header .= 'From: XXXXX@mydomain.com' . $this->newline;

It works!!

posted for reference only as I suffered a lot and I don't want for others.....

Re: not getting emails from contact us page opencart 2.0.3.1

Posted: Wed Jan 10, 2018 7:31 am
by straightlight
There is already an existing extension on the marketplace that resolves this issue without having to manually set your email. This problem is rather related with the base64 encoding for some hosts.

Re: not getting emails from contact us page opencart 2.0.3.1

Posted: Wed Jun 06, 2018 6:06 pm
by reynafabrics
straightlight wrote:
Wed Jan 10, 2018 7:31 am
There is already an existing extension on the marketplace that resolves this issue without having to manually set your email. This problem is rather related with the base64 encoding for some hosts.

I have just changed the following code at system/library/mail.php
It works for me and I hope it will helpful to someone.


Original:
$header .= 'Date: ' . date('D, d M Y H:i:s O') . $this->newline;
$header .= 'From: ' . '=?UTF-8?B?' . base64_encode($this->sender) . '?=' . ' <' . $this->from . '>' . $this->newline;
$header .= 'Reply-To: ' . '=?UTF-8?B?' . base64_encode($this->sender) . '?=' . ' <' . $this->from . '>' . $this->newline;
$header .= 'Return-Path: ' . $this->from . $this->newline;
$header .= 'X-Mailer: PHP/' . phpversion() . $this->newline;
$header .= 'Content-Type: multipart/related; boundary="' . $boundary . '"' . $this->newline . $this->newline;

Changed:
$header .= 'Date: ' . date('D, d M Y H:i:s O') . $this->newline;
//$header .= 'From: =?UTF-8?B?' . base64_encode($this->sender) . '?=' . ' <' . $this->from . '>' . $this->newline;
$header .= 'From: email@yourdomainname.com' . $this->newline;
if (!$this->reply_to) {
$header .= 'Reply-To: =?UTF-8?B?' . base64_encode($this->sender) . '?=' . ' <' . $this->from . '>' . $this->newline;
} else {
$header .= 'Reply-To: =?UTF-8?B?' . base64_encode($this->reply_to) . '?=' . ' <' . $this->from . '>' . $this->newline;
}
$header .= 'Return-Path: ' . $this->from . $this->newline;
$header .= 'X-Mailer: PHP/' . phpversion() . $this->newline;
$header .= 'Content-Type: multipart/related; boundary="' . $boundary . '"' . $this->newline . $this->newline;