Hello,

Yesterday, I updated "Printer, email and PDF versions" from 1.3 to 2.1.

Now I have the problem, that "Send by email" is not working any more:
I see the "Send by email" form, enter my data, click send ...
and I am just redirected to the original page where I came from.

- email is not send (I checked my mail server logs)
- no message "Mail sent" is shown
- no error message on the drupal logs
- no error message on the server logs

With Printer, email and PDF versions 1.3, the "Send by email"-function was working.

Am I missing a setting or do I need another module?

First, I updated the module from 1.3 to 2.1.
I also tried to uninstall "Printer, email and PDF versions" and install it again.
In both cases, the "Send by email"-function is not working.

Comments

blue1 created an issue. See original summary.

jcnventura’s picture

Weirdly enough, the solution to this is to remove some code added 8 years ago in #375892: Cancel button on send by email form triggers required fields validation.

A long time ago, pressing the cancel button would trigger validation. That doesn't happen anymore and nowadays the code that I used to detect that the cancel button had been pressed is also true when pressing the submit button. This code is exactly the same in print 7.x-1.3 which means this has either been broken by something in Drupal 7, or HTML5 browsers are doing something different than they used to do.

aschiwi’s picture

Which code needs to be removed? I can't find any commit message with the id of #375892.
I don't even get the old configuration page for print_mail by the way.

jcnventura’s picture

Hi Anja,

There's a wrapper to detect 'cancel' that used to work, and now it doesn't.. Still trying to understand when this changed. In any case, the current patch that makes it work is:

diff --git a/print_mail/print_mail.inc b/print_mail/print_mail.inc
index 17b0bce..aea2e48 100644
--- a/print_mail/print_mail.inc
+++ b/print_mail/print_mail.inc
@@ -388,7 +381,6 @@ function print_mail_form_validate($form, &$form_state) {
  * @ingroup forms
  */
 function print_mail_form_submit($form, &$form_state) {
-  if (!array_key_exists('cancel', $form_state['values'])) {
   module_load_include('inc', 'print', 'print.pages');
   module_load_include('inc', 'print', 'includes/print');

@@ -497,7 +489,6 @@ function print_mail_form_submit($form, &$form_state) {
         ->execute();
     }
   }
-  }

  • jcnventura committed 7d85c42 on 7.x-2.x
    Issue #3004236 by jcnventura: Send by email not working
    
jcnventura’s picture

Status: Active » Fixed
aschiwi’s picture

Thank you João :)
We still have more problems with this update so I can't yet confirm whether this will work. We are coming from a 1.3 with four mostly undocumented patches - it's always fun to take over projects other companies built...

jcnventura’s picture

Coming in from 1.3, you might need to also enable the 'print_ui' module to restore the links.

Please note that other than the 'script' vulnerability in dompdf, print 1.3 is not vulnerable to the easy-to-use remote code execution that motivated the release of 2.1. If you're not using dompdf, you might be able to stay at 1.3... After all, if you haven't updated in the last 6 years, there's some hope you don't need to update it in the next 3 while D7 and this module are still supported.

jcnventura’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.