Page 1 of 1

problem with email

Posted: Fri Feb 09, 2024 3:26 am
by vourlismenos
I have a 2.1.0.1 oc website.
Recently we moved our email hosting from our webhosting, to a third party (hostinger) in order to have more space and to use imap efficiently.

I just realised that after this move, the contact form of the website (and only the contact form) has some problems.
The protocol in the website is "Mail".
The contact form seems to be working fine - user gets the success message etc, but we never receive the email.
There is no error in the log. Every other email function of the website works just fine.

I tried switching to smtp.
All email functions (contact form, remind password, etc) stopped working. We get a blank page instead of success and the error: Notice: Error: EHLO not accepted from server!

Added ssl:// in front of the hostname and everything works except from the contact form. Instead of success message we get a blank page and the error: PHP Notice: Error: RCPT TO not accepted from server!

From what I see there are loads of similar threds, posts, solutions all over the forums and google.
Nothing I tried, seems to work.

The email settings are correct, as provided by the email hosting company and used everywhere else.

Any ideas what might be happening?
Thank you

Re: problem with email

Posted: Fri Feb 09, 2024 5:42 pm
by ADD Creative
For Mail, your server is probably still sending locally. If using cPanel setting Remote Mail Exchanger in the Email Routing may help. But use an online email deliverability checker to check everything is configured correctly.

For SMTP and possibly Mail. The version of OpenCart is probably trying to seed a email from the contact form filler's address, which any decent mail server would block. Try the change at. https://github.com/opencart/opencart/co ... 2f7903601e

Re: problem with email

Posted: Fri Feb 09, 2024 9:10 pm
by vourlismenos
I found a solution very similar to the one you've sent.

Code: Select all

//$mail->setFrom($this->request->post['email']);
$mail->setFrom($this->config->get('config_email'));
//$mail->setSender(html_entity_decode($this->request->post['name'], ENT_QUOTES, 'UTF-8'));
$mail->setSender($this->request->post['email']);
They both seem to work, but not without an extra change in system/library/mail.php that I found here: https://hosting.xyz/wiki/hosting/cms/op ... -accepted/

as far as I can see not all changes are needed.
I just had to change in #315

Code: Select all

//fputs($handle, 'MAIL FROM: <' . $this->from . '>' . "\r\n");
fputs($handle, 'MAIL FROM: <' . $this->user_name . '>' . "\r\n");
It seems to work fine now ???

Re: problem with email

Posted: Sat Feb 10, 2024 12:52 am
by paulfeakins
vourlismenos wrote:
Fri Feb 09, 2024 9:10 pm
It seems to work fine now ???
If it's still good in a few days, please add [SOLVED] to the start of this topic title.

Re: problem with email

Posted: Sat Feb 10, 2024 12:56 am
by vourlismenos
I will, still testing it!

Re: problem with email

Posted: Sat Feb 10, 2024 8:03 am
by ADD Creative
vourlismenos wrote:
Fri Feb 09, 2024 9:10 pm
I found a solution very similar to the one you've sent.

Code: Select all

//$mail->setFrom($this->request->post['email']);
$mail->setFrom($this->config->get('config_email'));
//$mail->setSender(html_entity_decode($this->request->post['name'], ENT_QUOTES, 'UTF-8'));
$mail->setSender($this->request->post['email']);
They both seem to work, but not without an extra change in system/library/mail.php that I found here: https://hosting.xyz/wiki/hosting/cms/op ... -accepted/

as far as I can see not all changes are needed.
I just had to change in #315

Code: Select all

//fputs($handle, 'MAIL FROM: <' . $this->from . '>' . "\r\n");
fputs($handle, 'MAIL FROM: <' . $this->user_name . '>' . "\r\n");
It seems to work fine now ???
That change is fine as long as your SMTP username is an email address. If you ever changed providers it may break things.

Re: problem with email

Posted: Sat Feb 10, 2024 6:12 pm
by vourlismenos
ADD Creative wrote:
Sat Feb 10, 2024 8:03 am
That change is fine as long as your SMTP username is an email address. If you ever changed providers it may break things.
True.
Even though all provides (so far) used the email as a username, I think the right way is to avoid that.