Keyword

Email Button does not work on items

  • Different Color
  • Different Color's Avatar Topic Author
  • Offline
  • Premium Member
More
15 years 4 months ago #76945 by Different Color
Email Button does not work on items was created by Different Color
I get an error "Email could not be sent" when I try to email an item using the the top tool bar. Is this a bug or are there other reasons it wouldn't work?

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.

More
14 years 5 months ago #76946 by Giulia Magnesa
Replied by Giulia Magnesa on topic Email Button does not work on items
I have the same problem. Did you resolve it?

Please Log in or Create an account to join the conversation.

  • Bryant West Pty Ltd
  • Bryant West Pty Ltd's Avatar
  • Offline
  • New Member
More
13 years 11 months ago #76947 by Bryant West Pty Ltd
Replied by Bryant West Pty Ltd on topic Email Button does not work on items
Me too... any further information woudl be gratly appreciated

Please Log in or Create an account to join the conversation.

More
13 years 11 months ago #76948 by Giulia Magnesa
Replied by Giulia Magnesa on topic Email Button does not work on items
Hello,

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
  • Bryant West Pty Ltd's Avatar
  • Offline
  • New Member
More
13 years 11 months ago #76949 by Bryant West Pty Ltd
Replied by Bryant West Pty Ltd on topic Email Button does not work on items
Trying it now, and thanks for the prompt reply!O is for Awesome (local humour)

 

Please Log in or Create an account to join the conversation.

  • Bryant West Pty Ltd
  • Bryant West Pty Ltd's Avatar
  • Offline
  • New Member
More
13 years 11 months ago #76950 by Bryant West Pty Ltd
Replied by Bryant West Pty Ltd on topic Email Button does not work on items
Hmmm.. sorry that didn;t worki've updated Joomla to 1.5.23The syntax I have is as follows

 

$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.

More
13 years 11 months ago #76951 by Giulia Magnesa
Replied by Giulia Magnesa on topic Email Button does not work on items
I'm sorry but I found this solution in this website www.voodish.co.uk, but it seems not work at all today.

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.

More
13 years 11 months ago #76952 by jeffreyd00
Replied by jeffreyd00 on topic Email Button does not work on items
I need a fix for this too. joomla 1.5.23 and K2

Please Log in or Create an account to join the conversation.

More
13 years 10 months ago #76953 by Adam
Replied by Adam on topic Email Button does not work on items
 

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.

More
13 years 10 months ago #76954 by jeffreyd00
Replied by jeffreyd00 on topic Email Button does not work on items
I ended up editing the K2 template (item.php) and replacing the email code with a sharethis.com code that only showed Email This Page option.

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.

More
13 years 10 months ago #76955 by turrikan
Replied by turrikan on topic Email Button does not work on items
Hi guys, i've a simple solution!

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.

More
13 years 10 months ago #76956 by jeffreyd00
Replied by jeffreyd00 on topic Email Button does not work on items
Turrikan,

 

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.

More
13 years 10 months ago #76957 by Adam
Replied by Adam on topic Email Button does not work on items
Thanks Turrikan!

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.

More
13 years 10 months ago #76958 by matthew turner
Replied by matthew turner on topic Email Button does not work on items
Hi,

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
  • BNR Investment Group's Avatar
  • Offline
  • Senior Member
More
13 years 10 months ago #76959 by BNR Investment Group
Replied by BNR Investment Group on topic Email Button does not work on items
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.

More
13 years 10 months ago #76960 by Adam
Replied by Adam on topic Email Button does not work on items
Great job Brent Friar! It works for me!

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.


Powered by Kunena Forum