Post by impairedspook » Thu Jun 30, 2016 3:43 pm

Hi all,

Just helping someone with their Opencart site but we are banging our heads against the wall when it comes to getting the emails working,,. Anyone have any ideas of what to try?

I have my own OC 2.1.0.2 store with emails setup and working fine using SMTP... no problems at all with my store. The store I am currently helping with is also OC 2.1.0.2 but even with the exact same SMTP settings no order emails go through...

Have tried the "Mail" setting with my gmail address earlier today and it worked, try his gmail address with "Mail" setting and no luck... then tried mine again just to test something and again no luck with mine now.

Have also contacted the hosting provider, all is well at their end and they have confirmed port 25 is open.

Also tried removing all extensions installed just in case but this made no difference.. basically have tried multiple gmail accounts, a hotmail account and proper domain email all with no luck except my gmail once but now nothing.

Why would his store not work even when using exact settings as mine and my store works fine? His setup is pretty much identical to mine so not sure what the problem could be...

Also made sure all admin settings were set to "yes" to make sure all emails are sent. Contact form seems to work with gmail addresses but not order emails.

Any help or ideas would be very much appreciated.

Cheers :)

Active Member

Posts

Joined
Sat Apr 26, 2014 4:44 am

Post by i2Paq » Thu Jun 30, 2016 5:21 pm

Any errors in you OC log or Serverlog?

Norman in 't Veldt
Moderator OpenCart Forums

_________________ READ and Search BEFORE POSTING _________________

Our FREE search: Find your answer FAST!.

[How to] BTW + Verzend + betaal setup.


User avatar
Global Moderator

Posts

Joined
Mon Nov 09, 2009 7:00 pm
Location - Winkel - The Netherlands

Post by artcore » Thu Jun 30, 2016 5:21 pm

http://lmgtfy.com/?q=Php+debug+mail+function

No disrespect meant. Easier to put a google url like that ;D

Attn: I no longer provide OpenCart extensions, nor future support - this includes forum posts.
Reason: OpenCart version 3+ ;D

Thanks!


User avatar
Active Member

Posts

Joined
Tue Jul 09, 2013 4:13 am
Location - The Netherlands

Post by impairedspook » Thu Jun 30, 2016 7:34 pm

Thanks for the replies... may have it sorted now :) fingers crossed will see how it goes for the next few test orders... Cheers

Active Member

Posts

Joined
Sat Apr 26, 2014 4:44 am

Post by impairedspook » Fri Jul 01, 2016 8:53 am

Ok update... last night all seemed to be working well for about 5 test orders. However this morning we have issues again..

What I have found today...

12.45pm placed test order received both emails (admin and customer copies)
12.46pm placed test order received only admin copy
12.47pm placed test order received only customer copy

All have different order numbers and nothing was changed between the 3 test orders but still having issues. Nothing in the error logs or anything to try and track what the problem may be...

Any ideas would be much appreciated :)

Cheers

Active Member

Posts

Joined
Sat Apr 26, 2014 4:44 am

Post by straightlight » Fri Jul 01, 2016 9:40 am

impairedspook wrote:Ok update... last night all seemed to be working well for about 5 test orders. However this morning we have issues again..

What I have found today...

12.45pm placed test order received both emails (admin and customer copies)
12.46pm placed test order received only admin copy
12.47pm placed test order received only customer copy

All have different order numbers and nothing was changed between the 3 test orders but still having issues. Nothing in the error logs or anything to try and track what the problem may be...

Any ideas would be much appreciated :)

Cheers
It looks like since you applied the same strategy to receive your emails in a constant way, it may be possible that your server tracks the short-time notice. Even dedicated servers may require to initiate chronologic tasks in order to receive emails between different time range rather than constant to avoid email filtering to track your emails synchronously.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

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

Post by impairedspook » Sun Jul 03, 2016 4:47 pm

Thanks straightline but still have issues even when I don't test quite like that... Been for the last few days with no luck. Seems now no order emails won't to work at all. Only thing that does is the contact form, that email goes through straight away. Really strange because I have my own OC 2.1.0.2 store and everything works fine there. But the one I am helping with will not work even with the exact same settings as my store.. :(

Any ideas will be greatly appreciated - hoping something will point me in the right direction as I have tried everything I can think of to get this working.

Cheers

Active Member

Posts

Joined
Sat Apr 26, 2014 4:44 am

Post by artcore » Sun Jul 03, 2016 6:18 pm

One thing to try is to make sure the sender is the store email and not the customer email.

In all mail function calls:
change setFrom to

Code: Select all

$mail->setFrom($this->config->get('config_email'));
and to be able to reply to customers, add:

Code: Select all

$mail->setReplyTo($this->request->post['email']);
Some/most servers don't allow external addresses to use for sending.
I have the above for all my OC's
Last edited by straightlight on Mon Aug 08, 2016 8:13 pm, edited 1 time in total.
Reason: Added code tags.

Attn: I no longer provide OpenCart extensions, nor future support - this includes forum posts.
Reason: OpenCart version 3+ ;D

Thanks!


User avatar
Active Member

Posts

Joined
Tue Jul 09, 2013 4:13 am
Location - The Netherlands

Post by impairedspook » Sun Jul 03, 2016 8:10 pm

Hi artcore, thanks for the reply, sorry where would make changes? Not that familiar with OC email setup... :)

Also update.. all emails seem to be working except admin and customer order emails... have tested out new customer, contact form, forgotten password, admin email and newsletter and all have worked except the most important ones...

Appreciate the help.

Cheers

Active Member

Posts

Joined
Sat Apr 26, 2014 4:44 am

Post by artcore » Sun Jul 03, 2016 8:21 pm

In the code where the mail() is called.
model/checkout/order.php -> addOrderHistory
controller/information/contact.php

Attn: I no longer provide OpenCart extensions, nor future support - this includes forum posts.
Reason: OpenCart version 3+ ;D

Thanks!


User avatar
Active Member

Posts

Joined
Tue Jul 09, 2013 4:13 am
Location - The Netherlands

Post by impairedspook » Sun Jul 03, 2016 8:37 pm

Hi artcore,

Thanks, in model/checkout/order.php..

Code: Select all

$mail->setFrom($this->config->get('config_email')); 
already exists but in controller/information/contact.php I replaced

Code: Select all

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

Code: Select all

$mail->setFrom($this->config->get('config_email')); 

but still had no luck receiving order emails..

Cheers ???
Last edited by straightlight on Mon Aug 08, 2016 8:14 pm, edited 1 time in total.
Reason: Added code tags.

Active Member

Posts

Joined
Sat Apr 26, 2014 4:44 am

Post by straightlight » Sun Jul 03, 2016 9:35 pm

impairedspook wrote:Hi artcore,

Thanks, in model/checkout/order.php.. $mail->setFrom($this->config->get('config_email')); already exists but in controller/information/contact.php I replaced $mail->setFrom($this->request->post['email']); with $mail->setFrom($this->config->get('config_email')); but still had no luck receiving order emails..

Cheers ???
What does it indicate in your error logs after making the changes?

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

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

Post by artcore » Sun Jul 03, 2016 9:57 pm

You really have to do some debugging.
Create a simple mail script in site root mailtest.php and use it to test
-f switch on sender email
with and without space after -f

Test with store mail sender, external email also.

and add this also to the top of it:

Code: Select all

ini_set('display_startup_errors',1);
ini_set('display_errors',1);
error_reporting(-1);
example:
https://www.conetix.com.au/support/arti ... -mail-test

There must be something that gives you a clue after this.

You can also try to use smtp of course
Last edited by straightlight on Mon Aug 08, 2016 8:15 pm, edited 1 time in total.
Reason: Added code tags.

Attn: I no longer provide OpenCart extensions, nor future support - this includes forum posts.
Reason: OpenCart version 3+ ;D

Thanks!


User avatar
Active Member

Posts

Joined
Tue Jul 09, 2013 4:13 am
Location - The Netherlands

Post by impairedspook » Mon Jul 04, 2016 7:01 am

Hi guys,

Thank you very much for the replies and help.. I think I might be sorted now (Fingers crossed) I have placed 6 test orders this morning and have received both the admin and customer order emails...

It seems it may of been just working out the host settings etc.. Once I was given access to the hosting plan I could then start playing around and trying to get the right port details etc.

For anyone else that may have issues.. Hosting is provided by Bluehost and the settings that seem to be working are...

- Under the "Store" tab make sure email is set to "youremail@yourdomain.com"

- Under the "Mail" tab..
Mail protocol: Mail
Mail parameters:
SMTP Hostname: mail.yourdomain.com
SMTP USername: youremail@yourdomain.com
SMTP Port: 26
SMTP Timeout: 5
Was a bit of a strange setup... past stores I have either used "mail" and the entered "-fyouremail@yourdomain" as the mail protocol or filled out all the details and used "SMTP". Never had to set it up like this before...

Really appreciate the help and hopefully all should go well now ;D

Cheers
Last edited by straightlight on Mon Aug 08, 2016 8:15 pm, edited 1 time in total.
Reason: Added quote tags.

Active Member

Posts

Joined
Sat Apr 26, 2014 4:44 am

Post by impairedspook » Mon Jul 04, 2016 2:45 pm

Hi guys,

Ok still not quite right... the store will send both admin and customer emails if I entered both email addresses as example@mydomain.com however if I change admin email to something else but leave customers as example@mydomain.com I receive only the customer copy. Leave admin as example@mydomain.com but change customers to something different then I receive only the admin email not the customers one.

What could cause the problem? Seems there is no issue with OC sending emails weather it be the admin or customer copies but just seems to not like having 2 different addresses... Or will only send emails to @mydomain.com...

If I setup both customer and admin emails the same but have an additional gmail address I will receive all 3 copies but change customer or admin email then even the additional email won't come through..

For the life of me I can't figure out what's going wrong... ???

It does not seem like there are problems with OC sending emails because why would it work when both emails are the same... Again any help will be greatly appreciated.

Active Member

Posts

Joined
Sat Apr 26, 2014 4:44 am
Who is online

Users browsing this forum: No registered users and 281 guests