Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emailing Reports doesn't work #53

Closed
gigatux opened this issue Jan 30, 2013 · 3 comments
Closed

Emailing Reports doesn't work #53

gigatux opened this issue Jan 30, 2013 · 3 comments
Milestone

Comments

@gigatux
Copy link

gigatux commented Jan 30, 2013

With mail_settings configured to send using PHP's mail function (and probably for all settings) I notice that the Email Report button attempts to get some JSON from a page called 'email' when the Send button is clicked. This page doesn't exist, so the mail cannot be sent.

The HTML/Javascript snippet that this seems to fail on (for all of my reports) is:

$.getJSON('http://dev.justaskmeout.co.uk/reporting/email',data,function(response) {
if(response && response.success) {
$('#email-report-modal').modal('hide');

Did this 'email' page use to exist at some point?

@jdorn
Copy link
Owner

jdorn commented Jan 30, 2013

The /email url should work fine. It's caught on line 41 of index.php.

If you go to http://dev.justaskmeout.co.uk/reporting/email without any GET string, what do you see? If it's working correctly, you should get:

{"error":"Valid email address required"}

@gigatux
Copy link
Author

gigatux commented Jan 30, 2013

Hi,

Can't believe I missed that. Having said that, by using Firebug and getting the GET URL used, I get the following error:

500 Internal Server Error
Unable to open file for reading [http://dev.justaskmeout.co.uk/reporting/report/csv/?report=jamo/activities/activities.sql]

#0 /home/dev/www/reporting/lib/Swift/classes/Swift/ByteStream/FileByteStream.php(83): Swift_ByteStream_FileByteStream->_getReadHandle()
#1 /home/dev/www/reporting/lib/Swift/classes/Swift/Mime/SimpleMimeEntity.php(705): Swift_ByteStream_FileByteStream->read(8192)
#2 /home/dev/www/reporting/lib/Swift/classes/Swift/Mime/SimpleMimeEntity.php(353): Swift_Mime_SimpleMimeEntity->_readStream(Object(Swift_ByteStream_FileByteStream))
#3 /home/dev/www/reporting/lib/Swift/classes/Swift/Mime/SimpleMimeEntity.php(489): Swift_Mime_SimpleMimeEntity->getBody()
#4 /home/dev/www/reporting/lib/Swift/classes/Swift/Mime/SimpleMimeEntity.php(471): Swift_Mime_SimpleMimeEntity->_bodyToString()
#5 /home/dev/www/reporting/lib/Swift/classes/Swift/Mime/SimpleMimeEntity.php(502): Swift_Mime_SimpleMimeEntity->toString()
#6 /home/dev/www/reporting/lib/Swift/classes/Swift/Mime/SimpleMimeEntity.php(471): Swift_Mime_SimpleMimeEntity->_bodyToString()
#7 /home/dev/www/reporting/lib/Swift/classes/Swift/Mime/SimpleMessage.php(580): Swift_Mime_SimpleMimeEntity->toString()
#8 /home/dev/www/reporting/lib/Swift/classes/Swift/Transport/MailTransport.php(144): Swift_Mime_SimpleMessage->toString()
#9 /home/dev/www/reporting/lib/Swift/classes/Swift/Mailer.php(86): Swift_Transport_MailTransport->send(Object(Swift_Message), Array)
#10 /home/dev/www/reporting/lib/PhpReports/PhpReports.php(421): Swift_Mailer->send(Object(Swift_Message))
#11 /home/dev/www/reporting/index.php(42): PhpReports::emailReport()
#12 /home/dev/www/reporting/lib/flight/flight/core/Dispatcher.php(154): {closure}()
#13 /home/dev/www/reporting/lib/flight/flight/core/Dispatcher.php(141): flight\core\Dispatcher::callFunction(Object(Closure), Array)
#14 /home/dev/www/reporting/lib/flight/flight/Flight.php(279): flight\core\Dispatcher::execute(Object(Closure), Array)
#15 /home/dev/www/reporting/lib/flight/flight/core/Dispatcher.php(181): Flight::_start()
#16 /home/dev/www/reporting/lib/flight/flight/core/Dispatcher.php(140): flight\core\Dispatcher::invokeMethod(Array, Array)
#17 /home/dev/www/reporting/lib/flight/flight/core/Dispatcher.php(47): flight\core\Dispatcher::execute(Array, Array)
#18 /home/dev/www/reporting/lib/flight/flight/Flight.php(54): flight\core\Dispatcher->run('start', Array)
#19 /home/dev/www/reporting/index.php(46): Flight::__callStatic('start', Array)
#20 /home/dev/www/reporting/index.php(46): Flight::start()
#21 {main}

This suggests that it's assuming that /repor/csv exists when it doesn't in the git repository. Is this likely to be a minor oversight?

Hmm, even creating this directory and making it a+rwx doesn't allow it to work. It's failing on a read to that directory, but at what point does it write, or is this supposed to be a link to the actual report as seen via a web browser?

Thanks for your assistance. It really is appreciated, and PHP Reports truly is excellent.

Marc

@jdorn
Copy link
Owner

jdorn commented Jan 30, 2013

Everything always gets routed through index.php so you don't need to create any directories or anything.

Currently, the script that sends out the email attaches a CSV file of the report. You need allow_url_fopen turned on in your php settings for this to work.

Thanks for catching this. I'll add a note to the documentation. I'll also try to put some better error messaging instead of just throwing a 500 error.

@jdorn jdorn closed this as completed in f5aaac7 Feb 11, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants