Summary

I found out today, thats the Recommend Email do not work.
When you will send a Recommend Email it shows Errror Notice after klick on Sendbutton. Error Notice: E-mail could not be sent.

I tryed every possible configuration, With sendmail, Smtp and phpmailer.
Normal Sitemails works ok.
This Bug seems also to be on joomla.org website: http://www.joomla.org/announcements/general-news/5229-joomla-15-coming-of-age-and-looking-forward.html

and on every other J1.5.9 website i found.

Greezz pctech
Opened On:
30 Jan 2009, 6:59 by Marcel Würsch
Closed On:
30 May 2009, 3:50
Status:
Closed

Filed Under

  • Developer

Responses

Posted on 30 Jan 2009, 7:40 by Marcel Würsch
It seems to be a Bug in Com_MailTo.
components/com_mailto/controller.php
There 3 possibilitis:
REQUEST CHECK
[code]
// Check for request forgeries
JRequest::checkToken() or jexit( 'Invalid Token' );
$session =& JFactory::getSession();
$db =& JFactory::getDBO();

$timeout = $session->get('com_mailto.formtime', 0);
if($timeout == 0 || time() - $timeout < 20) {
JError::raiseNotice( 500, JText:: _ ('EMAIL_NOT_SENT' ));
return $this->mailto();
}
[/code]

VERIFY LINK

[code]
// Verify that this is a local link
if(!JURI::isInternal($link)) {
//Non-local url...
JError::raiseNotice( 500, JText:: _ ('EMAIL_NOT_SENT' ));
return $this->mailto();
}
[/code]

SEND MAIL

[code]
// Send the email
if ( JUtility::sendMail($from, $sender, $email, $subject, $body) !== true )
{
JError::raiseNotice( 500, JText:: _ ('EMAIL_NOT_SENT' ));
return $this->mailto();
}
[/code]
Posted on 30 Jan 2009, 7:51 by Marcel Würsch
So i Try first: Disable the SEF functions to test the Link:
http://MYSITE.TLD/index.php?option=com_mailto&tmpl=component&link=aHR0cDovL2xpdHRsZWF0bGV5LnBjdGUuY2gvaW5kZXgucGhwP29wdGlvbj1jb21fY29udGVudCZ2aWV3PWFydGljbGUmaWQ9OTQ6cGN0ZWNoLXdlYnNlcnZpY2VzLWJhdXQtYW4tbGl0dGxlYXRsZXkmY2F0aWQ9NDI6YWt0dWVsbCZJdGVtaWQ9ODY=
Result: It Shows the Form in full windwos size.
I Check to send the Mail and it works. Email sucsessfully send.
So there is the Bug.
Posted on 30 Jan 2009, 7:58 by Marcel Würsch
The Own Difference i found was
Old: JError::raiseNotice( 500, 'EMAIL_NOT_SENT' );

New is :JError::raiseNotice( 500, JText:: _ ('EMAIL_NOT_SENT' ));

Posted on 30 Jan 2009, 8:23 by Marcel Würsch
Then i found Out:
I did just an personal Text to the Error warning:
EMAIL_NOT_SENTtimeout
EMAIL_NOT_SENTlink
EMAIL_NOT_SENTsendmailsection

So on the end it shows the Timeout error: EMAIL_NOT_SENTtimeout


// Check for request forgeries
So i set this: if($timeout == 0 || time() - $timeout < 20) {
in
if($timeout == 0 || time() - $timeout < 1) {

NOW it WORKS



Posted on 7 Mar 2009, 18:52 by Klas Berlič
Work ok on my instalation. Please provide more information about your system (OS, php verison etc.).
Posted on 12 Mar 2009, 10:40 by Nicole Rhoads
Hi -
I'm having the same problem, as is at least one other person. (See: forum thread at: http://forum.joomla.org/viewtopic.php?f=429&t=376453&p=1619908#p1619908 )

I'm running on Windows Server 2003, with Apache 2.2.9 and PHP 5.2.6. I just tried turning off SEF in the global config, but that didn't make any difference.

How else can I help with diagnosing this?

Nicole
Posted on 31 Mar 2009, 2:08 by Rupert Bailey
Marcel Würsch
The SEF function is a seperate error, and causes the Article Email to fail prior to successfully opening. I suggest a new bug report (if not already noted).

The bug submitted by Nicole Rhoads is a failure to send on pressing the "send" button. I also have the same error.

System Details:
Linux 2.6.27-11-generic (Server used by "DreamHost")
PHP Version 4.4.9
Joomla! 1.5.9 Production/Stable [ Vatani ] 9-January-2009 23:00 GMT
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.8) Gecko/2009032712 Ubuntu/8.10 (intrepid) Firefox/3.0.8

Regards, Rupert.
Posted on 31 Mar 2009, 8:06 by Rupert Bailey
I just realised what is going on!
Above the send() function is the mailTo() function which sets the current time is used as the "com_mailto.formtime" timestamp.
$session->set('com_mailto.formtime', time());
This is then used as the "start time" for the timeout between it and the next time time() is called.
so the timeout should occur at
time() - $timeout > 20
not
time() - $timeout < 20

Thus the LOGIC is wrong.

also 20 seconds might not be long enough. Suggest:
time() - $timeout > 20
please submit a change to the Joomla source to reflect this. (line 58)

if($timeout == 0 || time() - $timeout > 50) {
Posted on 31 Mar 2009, 15:09 by Marcel Würsch
Hello.
Is this Problem now solved? Will ir be Includet in next relase or is it allready done? Greezzz Pcte.ch
Posted on 31 Mar 2009, 17:57 by Marcel Würsch
One of the other things are: No Proofing of Inputs like same email address or Host viability. Also no check of same name. Strong.!
Posted on 1 Apr 2009, 5:55 by Rupert Bailey
Not sure, I'm using Joomla 1.5.9 stable and you're already up to 1.6.x. I don't presently have access to the Source Repository, so if you can check the file that would be sweet. It's such as small bug fix I'd suspect it should have been fixed on 1.5.10 (if that exists).
Posted on 20 Apr 2009, 18:51 by Christopher Pratt
Why was this bug report closed? I am using Joomla 1.5.10 and still having this problem. All other email functions of Joomla work perfectly, yet when trying to send Articles or Content to other people via the E-Mail icon Form, it displays the following:

E-mail could not be sent.

I've tried every possible E-Mail tweak to my Global Configuration and nothing solves this. PHP Mail, Sendmail, and SMTP.
Posted on 24 Apr 2009, 13:27 by Julio Delgado
Just confirming this bug, running ubuntu server 8.01, php 5.2 and apache 2.2.

Rupert Bailey's fix
"so the timeout should occur at
time() - $timeout > 20
not
time() - $timeout < 20"

seemed to work.
Posted on 28 Apr 2009, 18:03 by Klas Berlič
It is not closed, it is set to Unable to confirm. Will look into it.
Posted on 27 May 2009, 16:02 by Klas Berlič
I wonder how this ever worked:)

Patch is attached, thank you Rupert for tracking this down.
Posted on 29 May 2009, 11:03 by Klas Berlič
Hmm, I tested now and weird thing are happening - I have to look closer where the actual problem is.
Posted on 30 May 2009, 3:51 by Klas Berlič
It is actually ok the way it is - word timeout caused a little confusion, because it is actually "time before" - it is set to the time when recommend popup is loaded and 20 seconds time limit is minimum that has to pass before email can be sent.

So - no bug here. Closing.
Posted on 25 Jun 2009, 1:36 by Ricardo Goncalves
This issue was still not fixed in 1.5.11,
but I used teh above solution and it worked for me :)
Posted on 25 Jun 2009, 5:25 by Klas Berlič
This fix solves nothing and is logically wrong. Just don't click too fast on send (you have to wait 20 seconds).
Posted on 25 Jun 2009, 12:21 by Klas Berlič
Explanation: to prevent malicious bots from sending recommend mails time limit is imposed - it was determined that normally it takes at least 20 seconds to fill the form so sending works only after 20 seconds have passed. Patch reverses this logic - sending works from 0 to 20 seconds, which is faulty. It virtually fixes things for administrators filling their forms in less then 20 seconds with browsers help (browsers offering data that was entered in the form on previous visits), but opens the doors for bots and disables functionality for ordinary users which are filling form fields for the first time.
Posted on 15 Jul 2009, 17:59 by Ray Schroeter
Hi
As it makes sense having users to wait 20 seconds to prevent the form to be misused by bots... but how should a normal user get the idea behind it if the error just says 'unable to send mail' an no other hint is given?

How about some implementation like the one of installing add-ons in FF? Button is disabled and a countdown is shown in the buttons notation... simple, easy, understandable, could be done with JavaScript?!
Posted on 16 Jul 2009, 6:56 by Klas Berlič
Yes, that would be much more user-friendly. Contributions welcome.
Posted on 1 Oct 2010, 4:23 by jens peter jorgensen
I changed following in mail_to/tmpl/default.php and it fixes the problem with 20 sec security delay. The changes are marked with *****

<script language="javascript" type="text/javascript">
<!--
*****var now=new Date();




function submitbutton(pressbutton) {

*****var current=new Date();
*****while(current-now<20000){
*****var current=new Date();




*****}


var form = document.mailtoForm;

// do field validation
if (form.mailto.value == "" || form.from.value == "") {
alert( '<?php echo JText::_('EMAIL_ERR_NOINFO'); ?>' );
return false;
}


form.submit();
}
-->
</script>




Posted on 1 Oct 2010, 4:27 by jens peter jorgensen
I changed following in mail_to/tmpl/default.php and it fixes the problem with 20 sec security delay. The changes are marked with *****

<script language="javascript" type="text/javascript">
<!--
*****var now=new Date();




function submitbutton(pressbutton) {

*****var current=new Date();
*****while(current-now<20000){
*****var current=new Date();




*****}


var form = document.mailtoForm;

// do field validation
if (form.mailto.value == "" || form.from.value == "") {
alert( '<?php echo JText::_('EMAIL_ERR_NOINFO'); ?>' );
return false;
}


form.submit();
}
-->
</script>




Posted on 14 Mar 2013, 16:57 by Danny Drooghenbroodt
Hi this exact error is back in Joomla 2.5.9

Solution: To resolve this problem, open this file:

components/com_mailto/controller.php

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) {

Save, Upload and test.
You can also increase the time from 20 to say 50.
Posted on 13 Apr 2013, 3:44 by Danny Drooghenbroodt
I just read the original report again and now I see that this line of code is there to prevent people of sending spam mail by letting them wait at least 20 seconds before sending the mail. If I send the article from my fast server, I do it within the 20 sec time limit and I get the message "can't send e-mail" - in dutch: "kan mail niet versturen". If I change the code as mentioned above, I don't get the error anymore. If you want to prevent spam, use captcha but not a timelimit. I received allready many complaints about this error from many visitors to my site. You can see the error on this article (or any other article on this site): http://www.oostendseverhalen.be/verhalen-in-het-oostends/1736-den-ouwen-zen-ottoo.html (I use joomla 2.5.9)