- Posts: 99
COMMUNITY FORUM
Email Button does not work on items
- Different Color
-
Topic Author
- Offline
- Premium Member
www.villagechronicles.net
Emailing my Joomla Articles with the core email button does work fine.
Martha
Please Log in or Create an account to join the conversation.
- Giulia Magnesa
-
- Offline
- Senior Member
- Posts: 74
Please Log in or Create an account to join the conversation.
- Bryant West Pty Ltd
-
- Offline
- New Member
- Posts: 12
Please Log in or Create an account to join the conversation.
- Giulia Magnesa
-
- Offline
- Senior Member
- Posts: 74
I have resolved this problem in following way:
open the file components/com_mailto/controller.php
Locate the following line of code (approximatively line 57):
if ($timeout == 0 || time() - $timeout < 20)
Change the line to:
if ($timeout == 0 || time() - $timeout > 20)
Save, upload and test. You can increase the time from 20 to say 50.
Please Log in or Create an account to join the conversation.
- Bryant West Pty Ltd
-
- Offline
- New Member
- Posts: 12
Please Log in or Create an account to join the conversation.
- Bryant West Pty Ltd
-
- Offline
- New Member
- Posts: 12
$timeout = $session->get('com_mailto.formtime', time()); if($timeout == 0 || time() - $timeout < MAILTO_TIMEOUT) {I changed this to;$timeout = $session->get('com_mailto.formtime', time());
if ($timeout == 0 || time() - $timeout > 20) {Warning I'm no programmer... that didn't work - have I done somehting stupidly obvious?
I'm using PHP mail function in the joomla backend with SMTP Authentication set to 'No'Any ideas?
Please Log in or Create an account to join the conversation.
- Giulia Magnesa
-
- Offline
- Senior Member
- Posts: 74
As it is a bug of joomla try to see in Joomla.org forum
Please Log in or Create an account to join the conversation.
- jeffreyd00
-
- Offline
- New Member
- Posts: 12
Please Log in or Create an account to join the conversation.
- Adam
-
- Offline
- New Member
- Posts: 3
Same problem here with J1.5.23 and K2, and I got the email sending function works well, but it cause another problem.
I found it's not the problem of $timeout parametter.
See this in file controller.php in com_mailto:
/ /we return time() instead of 0 (as it previously was), so that the session variable has to be set in order to send the mail $timeout = $session->get('com_mailto.formtime', time()); if($timeout == 0 || time() - $timeout < MAILTO_TIMEOUT) { JError::raiseNotice( 500, JText:: _ ('EMAIL_NOT_SENT' )); return $this->mailto();.... and
// Verify that this is a local link if((!$link) || (!JURI::isInternal($link))) { //Non-local url... JError::raiseNotice( 500, JText:: _ ('EMAIL_NOT_SENT' )); return $this->mailto(); }
There are two cases when sending email can cause Joomla show you the "EMAIL_NOT_SENT" parameter in com_mailto in language file. Just change the first EMAIL_NOT_SENT to Error 1 (caused by $timeout) and the second EMAIL_NOT_SENT to Error 2 or whatever you want and then comeback with sending email function of K2. Then you will see it show you the Error 2, mean this error caused by something related to "if((!$link) || (!JURI::isInternal($link)))".
But sorry, I'm not a programmer and I just don't know how to fix :P, I even don't know what it does in com_mailto. I just delete it and email sending goes fine! Here are lines I deleted:
// Verify that this is a local link if((!$link) || (!JURI::isInternal($link))) { //Non-local url... JError::raiseNotice( 500, JText:: _ ('EMAIL_NOT_SENT' )); return $this->mailto(); }
When this deleted, email sending works ok, but there is no link to you article included in the email. That's is "another problem" I mentiond before :P
If anyone could help, please let me know
Please Log in or Create an account to join the conversation.
- jeffreyd00
-
- Offline
- New Member
- Posts: 12
Not elegant but it works. Would be nice if the K2 developers could help address get to the core of the problem as it seems it is K2 and not Joomla Core to me.
Please Log in or Create an account to join the conversation.
- turrikan
-
- Offline
- New Member
- Posts: 2
You have to upload controller.php from 1.5.10 Joomla! version and change this line:
Locate the following line of code (approximately line 57):if($timeout == 0 || time() - $timeout < 20) {Change the line to the following:if($timeout == 0 || time() - $timeout > 20) {
Now it wotks. Bye bye
PS. The correct file is uploaded in this message.
Please Log in or Create an account to join the conversation.
- jeffreyd00
-
- Offline
- New Member
- Posts: 12
I think it might be unwise to upload older file. Joomla coders obviously changed the controller.php file for a reason, maybe security issues.
Please Log in or Create an account to join the conversation.
- Adam
-
- Offline
- New Member
- Posts: 3
But may be we should have a look at changes between those two files
Please Log in or Create an account to join the conversation.
- matthew turner
-
- Offline
- Senior Member
- Posts: 66
Joomla 1.5.23
edit components/com_mailto/controller.php
Line20
define('MAILTO_TIMEOUT', 20);
change to a lower timeout :
define('MAILTO_TIMEOUT', 5);
I don't like editing core files but this does work.
Please Log in or Create an account to join the conversation.
- BNR Investment Group
-
- Offline
- Senior Member
- Posts: 47
First, the Joomla error messages are not very helpful. I changed the time out error message to indicate the form was being sent too fast. I also changed the local link error message to reflect that the link being sent was not correct. Once you know what the actual problem breaking the send is, it's a lot easier to fix the problem.
The timeout it not a bad idea, but 20 seconds is way too long. Too many people have forms autofilled by their browser or plugins so 10 seconds or even 5 seconds seems more reasonable. A bot will take much less than 5 seconds so you should still be good there. As Mat mentioned, in components/com_mailto/controller.php on line 20, adjust the defined minimum time before sending -
define('MAILTO_TIMEOUT', 20);
The other problem comes in the local link test. Many people seem to think this has something to do with the domain of the sender email, but it's actually it is testing the URL being sent. The problem is that Joomla encodes the URL being sent as a security measure. This is a great as many hosts won't allow URLs in a form parameter to begin with. The problem is that when they started encoding the URL, they do not decode it before testing if the link being sent is a link from within the site or not. Again, this is a very important check, otherwise it would be trivial to send malicious links through your form. The fix is easy. Again in components/com_mailto/controller.php at line 74 look for
$link = MailtoHelper::validateHash(JRequest::getString('link', '', 'post'));
and change it to
$link = base64_decode(JRequest::getString('link', '', 'post'));
Your send email should now work properly without opening up a huge security hole in you site.
Please Log in or Create an account to join the conversation.
- Adam
-
- Offline
- New Member
- Posts: 3
Thanks!
Brent Friar said:
Ok, after messing with this for quite some time, I have everything working. Here is what I found -
First, the Joomla error messages are not very helpful. I changed the time out error message to indicate the form was being sent too fast. I also changed the local link error message to reflect that the link being sent was not correct. Once you know what the actual problem breaking the send is, it's a lot easier to fix the problem.
The timeout it not a bad idea, but 20 seconds is way too long. Too many people have forms autofilled by their browser or plugins so 10 seconds or even 5 seconds seems more reasonable. A bot will take much less than 5 seconds so you should still be good there. As Mat mentioned, in components/com_mailto/controller.php on line 20, adjust the defined minimum time before sending -
define('MAILTO_TIMEOUT', 20);
The other problem comes in the local link test. Many people seem to think this has something to do with the domain of the sender email, but it's actually it is testing the URL being sent. The problem is that Joomla encodes the URL being sent as a security measure. This is a great as many hosts won't allow URLs in a form parameter to begin with. The problem is that when they started encoding the URL, they do not decode it before testing if the link being sent is a link from within the site or not. Again, this is a very important check, otherwise it would be trivial to send malicious links through your form. The fix is easy. Again in components/com_mailto/controller.php at line 74 look for
$link = MailtoHelper::validateHash(JRequest::getString('link', '', 'post'));
and change it to
$link = base64_decode(JRequest::getString('link', '', 'post'));
Your send email should now work properly without opening up a huge security hole in you site.
Please Log in or Create an account to join the conversation.