Page 1 of 1
Is it possible to extend the timeout period of outgoing emails from OpenCart?
Posted: Thu Dec 03, 2020 6:01 am
by RideTheWave
Sometimes my outgoing mail is very slow to send. Sometimes it could take a few minutes before the email sends. This is likely an issue with the host. Whenever this happens, automated order confirmation emails sent to a customer after a purchase don't get sent. The emails sent to a customer after an order status update also don't get sent (we get an "Internal Server Error" in the admin page). So I was wondering if there was a setting in OpenCart that allowed the site to wait longer for emails to be sent before giving that error (ie/ extend the timeout period). I'm using OpenCart 2.3.0.2. Does anyone know if such a setting exists?
Re: Is it possible to extend the timeout period of outgoing emails from OpenCart?
Posted: Thu Dec 03, 2020 6:14 am
by ADD Creative
Assuming you are using SMTP as the Mail Protocol in the OpenCart Mail settings. Have you tried increasing the SMTP Timeout value in the OpenCart Mail?settings?
Have you tried using Mail as the Mail Protocol in the OpenCart Mail settings?
Re: Is it possible to extend the timeout period of outgoing emails from OpenCart?
Posted: Thu Dec 03, 2020 6:22 am
by RideTheWave
I'm using SMTP in the mail protocol setting. I see the SMTP Timeout, it's currently set to 7. Is that in seconds? What is the recommend value this should be and what value should it be if I have a slow sending email?
Re: Is it possible to extend the timeout period of outgoing emails from OpenCart?
Posted: Thu Dec 03, 2020 6:56 am
by RideTheWave
ADD Creative wrote: ↑Thu Dec 03, 2020 6:14 am
Assuming you are using SMTP as the Mail Protocol in the OpenCart Mail settings. Have you tried increasing the SMTP Timeout value in the OpenCart Mail?settings?
Have you tried using Mail as the Mail Protocol in the OpenCart Mail settings?
By the way, what's the difference between using Mail and SMTP in the mail protocol setting?
Re: Is it possible to extend the timeout period of outgoing emails from OpenCart?
Posted: Thu Dec 03, 2020 8:16 am
by ADD Creative
RideTheWave wrote: ↑Thu Dec 03, 2020 6:22 am
I'm using SMTP in the mail protocol setting. I see the SMTP Timeout, it's currently set to 7. Is that in seconds? What is the recommend value this should be and what value should it be if I have a slow sending email?
Yes, it's in seconds, I think the default is 5. You won't want it too big as it will delay the resulting page displaying. Also you probably don't want it bigger than your PHP max_execution_time setting.
RideTheWave wrote: ↑Thu Dec 03, 2020 6:56 am
By the way, what's the difference between using Mail and SMTP in the mail protocol setting?
Mail will use the PHP mail function. This will likely be configured to send to the servers MTA (mail transfer agent). Mail is likely to be quicker as it's not likely to have to wait. The MTA will do that part. However, if not configure correctly it could increase the chance the email will be classed as spam.
https://www.php.net/manual/en/function.mail.php
SMTP will use OpenCart's SMTP class to send to the mail server in the SMTP Hostname setting, using the SMTP protocol.
Re: Is it possible to extend the timeout period of outgoing emails from OpenCart?
Posted: Thu Dec 03, 2020 8:38 am
by RideTheWave
In my php.ini file, the max_execution_time is set to 36000. Is that also in seconds, and if so isn't that a pretty high value? I don't remember changing this, is that the default value?
Re: Is it possible to extend the timeout period of outgoing emails from OpenCart?
Posted: Thu Dec 03, 2020 10:53 am
by ADD Creative
RideTheWave wrote: ↑Thu Dec 03, 2020 8:38 am
In my php.ini file, the max_execution_time is set to 36000. Is that also in seconds, and if so isn't that a pretty high value? I don't remember changing this, is that the default value?
Yes that is also in seconds. The default is 30, but different host will set different defaults.
Re: Is it possible to extend the timeout period of outgoing emails from OpenCart?
Posted: Thu Dec 03, 2020 7:26 pm
by paulfeakins
RideTheWave wrote: ↑Thu Dec 03, 2020 8:38 am
In my php.ini file, the max_execution_time is set to 36000. Is that also in seconds, and if so isn't that a pretty high value? I don't remember changing this, is that the default value?
That's too high. If a certain script requires a high timeout like that it should set it itself. Otherwise you risk threads crashing and not being killed off quickly enough.
Re: Is it possible to extend the timeout period of outgoing emails from OpenCart?
Posted: Sat Dec 05, 2020 4:45 pm
by OSWorX
RideTheWave wrote: ↑Thu Dec 03, 2020 6:56 am
By the way, what's the difference between using Mail and SMTP in the mail protocol setting?
Using the native php mail is the most worst decision one can make.
Why?
Because no security and anything else is used.
That's why SMTP should be used.
And here the domain own mailserver.
Why?
Because here you can define some very important settings like SPAM, Virusscanner, DKIM, SPDIF and so on.
And it the all are set correct, you can be sure that your emails will be delivered.
And receiving them means also they have tp pass all security settings successfully.
I see some store owners using GMail as their "mail provider".
Now assume you are the customer and you order in the store "supadupastore.com"
And you receive an email from the iamthebest @ gmail.com
What do you think now?
Are you confident with that sender?
Can this really be trusted - because the email comes from an gmail account?
Many fake shops are working this way - so avoid to use gmail as the mail provider!
Re: Is it possible to extend the timeout period of outgoing emails from OpenCart?
Posted: Tue Dec 29, 2020 9:59 am
by RideTheWave
ADD Creative wrote: ↑Thu Dec 03, 2020 8:16 am
RideTheWave wrote: ↑Thu Dec 03, 2020 6:56 am
By the way, what's the difference between using Mail and SMTP in the mail protocol setting?
Mail will use the PHP mail function. This will likely be configured to send to the servers MTA (mail transfer agent). Mail is likely to be quicker as it's not likely to have to wait. The MTA will do that part. However, if not configure correctly it could increase the chance the email will be classed as spam.
https://www.php.net/manual/en/function.mail.php
SMTP will use OpenCart's SMTP class to send to the mail server in the SMTP Hostname setting, using the SMTP protocol.
If I wanted to switch to using Mail instead of SMTP, is it simply a matter of just selecting "Mail" in the dropdown menu of "Mail Protocol" in the store settings? Do I have to specify my return email address somewhere else?
Beneath "Mail Protocol" is "Mail Parameters." That's currently blank. Do I have to add anything there in order to use the "Mail" protocol?
Re: Is it possible to extend the timeout period of outgoing emails from OpenCart?
Posted: Tue Dec 29, 2020 11:02 am
by by mona
Re: Is it possible to extend the timeout period of outgoing emails from OpenCart?
Posted: Tue Dec 29, 2020 1:04 pm
by straightlight
The OP user uses SMTP. The presented video shows how to setup mail protocol only near the end.
Re: Is it possible to extend the timeout period of outgoing emails from OpenCart?
Posted: Tue Dec 29, 2020 1:27 pm
by by mona
and at the very end of the video there is how to set up multiple admin emails
and below the video is a screenshot for the mail settings
Happy Holidays
PS to the right there is a full menu of basic set up instructions

and as a pre-emptive measure ..
viewtopic.php?t=44115
Re: Is it possible to extend the timeout period of outgoing emails from OpenCart?
Posted: Tue Dec 29, 2020 8:14 pm
by straightlight
Mail protocol is not safe. SMTP with TLS / SSL is rather recommended.
Re: Is it possible to extend the timeout period of outgoing emails from OpenCart?
Posted: Tue Dec 29, 2020 10:37 pm
by by mona
@straightlight - yes agreed
OSWorX wrote: ↑Sat Dec 05, 2020 4:45 pm
RideTheWave wrote: ↑Thu Dec 03, 2020 6:56 am
By the way, what's the difference between using Mail and SMTP in the mail protocol setting?
Using the native php mail is the most worst decision one can make.
Why?
Because no security and anything else is used.
That's why SMTP should be used.
And here the domain own mailserver.
Why?
Because here you can define some very important settings like SPAM, Virusscanner, DKIM, SPDIF and so on.
And it the all are set correct, you can be sure that your emails will be delivered.
And receiving them means also they have tp pass all security settings successfully.
This is good advice. My original post was carefully selected.
It both answers the OPs subsequent question and guides others searching the forum how to follow the good advice.
Win win ..
Re: Is it possible to extend the timeout period of outgoing emails from OpenCart?
Posted: Wed Dec 30, 2020 2:28 am
by ADD Creative
RideTheWave wrote: ↑Tue Dec 29, 2020 9:59 am
If I wanted to switch to using Mail instead of SMTP, is it simply a matter of just selecting "Mail" in the dropdown menu of "Mail Protocol" in the store settings? Do I have to specify my return email address somewhere else?
Beneath "Mail Protocol" is "Mail Parameters." That's currently blank. Do I have to add anything there in order to use the "Mail" protocol?
Yes, just select Mail as the "Mail Protocol". You can usually set the return address in the "Mail Parameters" by prefixing with -f. So if your email was test@example.com enter.
Re: Is it possible to extend the timeout period of outgoing emails from OpenCart?
Posted: Wed Dec 30, 2020 3:24 am
by by mona
If I may
The return address is usually taken from the email address set in the store tab in the settings section of admin.
However there are occasions when the parameter -f is required and sometimes it needs to be a capital letter -F and sometimes there requires a space between the -f or the -F and the subsequent email address i.e. -f mymail@mail dot xxx
As a disclaimer, it is not advisable for security reasons to use the mail parameter and you should use smtp whenever possible.
Re: Is it possible to extend the timeout period of outgoing emails from OpenCart?
Posted: Wed Dec 30, 2020 10:25 am
by RideTheWave
straightlight wrote: ↑Tue Dec 29, 2020 8:14 pm
Mail protocol is not safe. SMTP with TLS / SSL is rather recommended.
When you say Mail protocol is not safe, what are some examples of harmful things that could happen? Does it make the site more prone to being hacked or is it a matter of the actual emails getting hacked?
So do I have to put my email address in the Mail Parameters section or can I leave that blank? If the return address is automatically the email address you put in the Store settings, what's the purpose of Mail Parameters?
Re: Is it possible to extend the timeout period of outgoing emails from OpenCart?
Posted: Wed Dec 30, 2020 10:48 am
by straightlight
RideTheWave wrote: ↑Wed Dec 30, 2020 10:25 am
straightlight wrote: ↑Tue Dec 29, 2020 8:14 pm
Mail protocol is not safe. SMTP with TLS / SSL is rather recommended.
When you say Mail protocol is not safe, what are some examples of harmful things that could happen? Does it make the site more prone to being hacked or is it a matter of the actual emails getting hacked?
So do I have to put my email address in the Mail Parameters section or can I leave that blank? If the return address is automatically the email address you put in the Store settings, what's the purpose of Mail Parameters?
Google:
From my experience, most users prefer SMTP to PHP, as PHP tends to have longer delays in mail sending via forms. SMTP works a lot smoother and PHP forms are not as secure. I also had the experience of using PHPmailer depending on the hoster's architecture.
As for the SMTP configuration, login to your cPanel > Emails > <Your Email > > Settings > Lower-left side (SSL). See your host's configuration.
Re: Is it possible to extend the timeout period of outgoing emails from OpenCart?
Posted: Fri Jan 01, 2021 5:42 am
by ADD Creative
RideTheWave wrote: ↑Wed Dec 30, 2020 10:25 am
When you say Mail protocol is not safe, what are some examples of harmful things that could happen? Does it make the site more prone to being hacked or is it a matter of the actual emails getting hacked?
So do I have to put my email address in the Mail Parameters section or can I leave that blank? If the return address is automatically the email address you put in the Store settings, what's the purpose of Mail Parameters?
You can leave it blank, but it will then probably use the your hosting default mail account and not the address you set in OpenCart. It depends on how your hosting is set up.
As for security, it again depends on how your hosting is set up. If set correctly the PHP mail will likely be sending directly to the same local MTA program that receives email via SMTP.