CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • No event confirmation email sent from Civi after online reg w/ PayPal Standard
Pages: [1]

Author Topic: No event confirmation email sent from Civi after online reg w/ PayPal Standard  (Read 3937 times)

Guy Iaccarino

  • I post occasionally
  • **
  • Posts: 92
  • Karma: 5
    • Greenleaf Advancement
  • CiviCRM version: 4.4.10, 4.5.4
  • CMS version: WordPress 4, Drupal 7, Drupal 6, Joomla 3
  • MySQL version: 5.5
  • PHP version: 5.3
No event confirmation email sent from Civi after online reg w/ PayPal Standard
February 20, 2013, 01:45:34 pm
We are using PayPal Website Payments Standard to process payments for online event registrations, but can't get the email confirmation to be sent from Civi. This is happening for two of my clients, both on Civi 4.2.7, one on WordPress 3.5 and one on Drupal 6.2.6.

Here is what happens:
  • The payment goes through,
  • the contribution gets marked as Completed,
  • the log entry is "[info] Contribution record updated successfully
  • an email receipt from PayPal is sent to the user,
  • no email receipt is sent from CiviCRM, even though the radio button is selected in the event setup.
  • the log entry that should say "[info] Success: Database updated and mail sent" is absent

We have set up both PayPal accounts per the instructions here: http://wiki.civicrm.org/confluence/display/CRMDOC40/PayPal+Website+Payments+Standard+and+Recurring+Contributions. Also, the Civi receipt is received when an online contribution is made. It's only for events that it doesn't get sent.

We've even thought that maybe it had something to do with enabling people to register others, but toggling that made no difference either. Any ideas? All help greatly appreciated!
Guy Iaccarino
www.greenleafadvancement.com

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: No event confirmation email sent from Civi after online reg w/ PayPal Standard
February 20, 2013, 02:37:29 pm

There was a bug with regard to receipting and profiles for wordpress which has been fixed in 4.2.8

http://issues.civicrm.org/jira/browse/CRM-11913

might want to download and check if that fixes the issues with receipting

we dont actively support drupal6, so u'll need to dive into the code and figure out whats happening there

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Guy Iaccarino

  • I post occasionally
  • **
  • Posts: 92
  • Karma: 5
    • Greenleaf Advancement
  • CiviCRM version: 4.4.10, 4.5.4
  • CMS version: WordPress 4, Drupal 7, Drupal 6, Joomla 3
  • MySQL version: 5.5
  • PHP version: 5.3
Re: No event confirmation email sent from Civi after online reg w/ PayPal Standard
February 20, 2013, 02:52:12 pm
Ok, thanks Lobo. I expected that answer for Drupal 6, but I thought I would include it in case it helped provide any context. The drupal 6 site is getting upgraded to drupal 7 shortly anyway.

We'll load up WordPress 4.2.8 and see what happens.

Thanks again,

Guy
Guy Iaccarino
www.greenleafadvancement.com

Guy Iaccarino

  • I post occasionally
  • **
  • Posts: 92
  • Karma: 5
    • Greenleaf Advancement
  • CiviCRM version: 4.4.10, 4.5.4
  • CMS version: WordPress 4, Drupal 7, Drupal 6, Joomla 3
  • MySQL version: 5.5
  • PHP version: 5.3
Re: No event confirmation email sent from Civi after online reg w/ PayPal Standard
February 22, 2013, 04:19:36 am
Upgrading to 4.2.8 fixed this problem for us, as prescribed. Thanks Lobo!
Guy Iaccarino
www.greenleafadvancement.com

hakanuner

  • I’m new here
  • *
  • Posts: 9
  • Karma: 0
  • CiviCRM version: 4.4.1
  • CMS version: WordPress 3.7.1
  • MySQL version: 5.5.30
  • PHP version: 5.4
Re: No event confirmation email sent from Civi after online reg w/ PayPal Standard
April 27, 2013, 04:52:16 am
Hi there,

I've upgraded to the latest CiviCRM version (4.3.1) on a WordPress 3.5.1 installation. The fix in 4.2.8 doesn't seem to have fixed things. I am still having the same problem of Confirmation Emails not being sent for Online Event Registrations with PayPal Standard. I am receiving email receipts from PayPal, but not from CiviCRM although the option is chosen on the Event settings, as per the original post.

Is there any recommended work around for this problem, other than writing my own script and CRON job that will force send emails??

Regards,

Hakan

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: No event confirmation email sent from Civi after online reg w/ PayPal Standard
April 27, 2013, 05:07:50 pm

can you check and ensure that the paypal ipn is being sent and processed by civicrm

is the event participant marked as registered and the payment as completed?

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

hakanuner

  • I’m new here
  • *
  • Posts: 9
  • Karma: 0
  • CiviCRM version: 4.4.1
  • CMS version: WordPress 3.7.1
  • MySQL version: 5.5.30
  • PHP version: 5.4
Re: No event confirmation email sent from Civi after online reg w/ PayPal Standard
April 27, 2013, 08:53:52 pm
Quote from: Donald Lobo on April 27, 2013, 05:07:50 pm

can you check and ensure that the paypal ipn is being sent and processed by civicrm

is the event participant marked as registered and the payment as completed?

lobo


Hi Donald,

Yes the participant is marked Registered and te Payment is complete on CiviCRM.

Please refer to the attachments. The Invoice ID on the second attachment matches the transaction in our PayPal account. So that would prove that the IPN notification is working?

I also did a quick try on the demo site for WordPress last night and the notification email doesn't work with that either..

Regards,

Hakan
« Last Edit: April 27, 2013, 09:06:03 pm by hakanuner »

hakanuner

  • I’m new here
  • *
  • Posts: 9
  • Karma: 0
  • CiviCRM version: 4.4.1
  • CMS version: WordPress 3.7.1
  • MySQL version: 5.5.30
  • PHP version: 5.4
Re: No event confirmation email sent from Civi after online reg w/ PayPal Standard
May 02, 2013, 10:37:36 pm
HI guys,

Since there was no response to this, I did some caveman debugging myself and sort of pinpointed where things go wrong, but still I'm a novice with CiviCRM code, so any help would be appreciated.

I pretty much polluted the "civicrm/civicrm/CRM/Core/BAO/MessageTemplates.php"

Code: [Select]
  /**
   * Send an email from the specified template based on an array of params
   *
   * @param array $params  a string-keyed array of function params, see function body for details
   *
   * @return array  of four parameters: a boolean whether the email was sent, and the subject, text and HTML templates
   */
  static function sendTemplate($params) {
    $defaults = array(
      // option group name of the template
      'groupName' => NULL,
      // option value name of the template
      'valueName' => NULL,
      // ID of the template
      'messageTemplateID' => NULL,
      // contact id if contact tokens are to be replaced
      'contactId' => NULL,
      // additional template params (other than the ones already set in the template singleton)
      'tplParams' => array(),
      // the From: header
      'from' => NULL,
      // the recipient’s name
      'toName' => NULL,
      // the recipient’s email - mail is sent only if set
      'toEmail' => NULL,
      // the Cc: header
      'cc' => NULL,
      // the Bcc: header
      'bcc' => NULL,
      // the Reply-To: header
      'replyTo' => NULL,
      // email attachments
      'attachments' => NULL,
      // whether this is a test email (and hence should include the test banner)
      'isTest' => FALSE,
      // filename of optional PDF version to add as attachment (do not include path)
      'PDFFilename' => NULL,
    );
    $params = array_merge($defaults, $params);

CRM_Core_Error::debug_log_message("MSGTMPLPHP POINT1!!!!!!!!!!!!!");

    if ((!$params['groupName'] ||
        !$params['valueName']
      ) &&
      !$params['messageTemplateID']
    ) {
      CRM_Core_Error::fatal(ts("Message template's option group and/or option value or ID missing."));
    }

    if ($params['messageTemplateID']) {
    CRM_Core_Error::debug_log_message("MSGTMPLPHP POINT2!!!!!!!!!!!!!");
      // fetch the three elements from the db based on id
      $query = 'SELECT msg_subject subject, msg_text text, msg_html html, pdf_format_id format
                      FROM civicrm_msg_template mt
                      WHERE mt.id = %1 AND mt.is_default = 1';
      $sqlParams = array(1 => array($params['messageTemplateID'], 'String'));
    }
    else {
    CRM_Core_Error::debug_log_message("MSGTMPLPHP POINT3!!!!!!!!!!!!!");
      // fetch the three elements from the db based on option_group and option_value names
      $query = 'SELECT msg_subject subject, msg_text text, msg_html html, pdf_format_id format
                      FROM civicrm_msg_template mt
                      JOIN civicrm_option_value ov ON workflow_id = ov.id
                      JOIN civicrm_option_group og ON ov.option_group_id = og.id
                      WHERE og.name = %1 AND ov.name = %2 AND mt.is_default = 1';
      $sqlParams = array(1 => array($params['groupName'], 'String'), 2 => array($params['valueName'], 'String'));
    }
    $dao = CRM_Core_DAO::executeQuery($query, $sqlParams);
    $dao->fetch();

    if (!$dao->N) {
    CRM_Core_Error::debug_log_message("MSGTMPLPHP POINT4!!!!!!!!!!!!!");
      if ($params['messageTemplateID']) {
        CRM_Core_Error::fatal(ts('No such message template: id=%1.', array(1 => $params['messageTemplateID'])));
      }
      else {
        CRM_Core_Error::fatal(ts('No such message template: option group %1, option value %2.', array(1 => $params['groupName'], 2 => $params['valueName'])));
      }
    }

    $subject = $dao->subject;
    $text    = $dao->text;
    $html    = $dao->html;
    $format  = $dao->format;
    $dao->free();

    // add the test banner (if requested)
    if ($params['isTest']) {
      $query = "SELECT msg_subject subject, msg_text text, msg_html html
                      FROM civicrm_msg_template mt
                      JOIN civicrm_option_value ov ON workflow_id = ov.id
                      JOIN civicrm_option_group og ON ov.option_group_id = og.id
                      WHERE og.name = 'msg_tpl_workflow_meta' AND ov.name = 'test_preview' AND mt.is_default = 1";
      $testDao = CRM_Core_DAO::executeQuery($query);
      $testDao->fetch();

      $subject = $testDao->subject . $subject;
      $text    = $testDao->text . $text;
      $html    = preg_replace('/<body(.*)$/im', "<body\\1\n{$testDao->html}", $html);
      $testDao->free();
    }

    // replace tokens in the three elements (in subject as if it was the text body)
    $domain             = CRM_Core_BAO_Domain::getDomain();
    $hookTokens         = array();
    $mailing            = new CRM_Mailing_BAO_Mailing;
    $mailing->body_text = $text;
    $mailing->body_html = $html;
    $tokens             = $mailing->getTokens();
    CRM_Utils_Hook::tokens($hookTokens);
    $categories = array_keys($hookTokens);

    $contactID = CRM_Utils_Array::value('contactId', $params);
CRM_Core_Error::debug_log_message("MSGTMPLPHP POINT5!!!!!!!!!!!!!");
    if ($contactID) {
    CRM_Core_Error::debug_log_message("MSGTMPLPHP POINT   1 !!!!!!!!!!!!!");
      $contactParams = array('contact_id' => $contactID);
      $returnProperties = array();

      if (isset($tokens['text']['contact'])) {
      CRM_Core_Error::debug_log_message("MSGTMPLPHP POINT   2 !!!!!!!!!!!!!");
        foreach ($tokens['text']['contact'] as $name) {
          $returnProperties[$name] = 1;
        }
      }

      if (isset($tokens['html']['contact'])) {
      CRM_Core_Error::debug_log_message("MSGTMPLPHP POINT   3 !!!!!!!!!!!!!");
        foreach ($tokens['html']['contact'] as $name) {
          $returnProperties[$name] = 1;
        }
      }
      CRM_Core_Error::debug_log_message("MSGTMPLPHP POINT   4 !!!!!!!!!!!!!");
      list($contact) = CRM_Utils_Token::getTokenDetails($contactParams,
        $returnProperties,
        FALSE, FALSE, NULL,
        CRM_Utils_Token::flattenTokens($tokens),
        // we should consider adding groupName and valueName here
        'CRM_Core_BAO_MessageTemplate'
      );
      $contact = $contact[$contactID];
      CRM_Core_Error::debug_log_message("MSGTMPLPHP POINT   5 !!!!!!!!!!!!!");
    }

    $subject = CRM_Utils_Token::replaceDomainTokens($subject, $domain, TRUE, $tokens['text'], TRUE);
    $text    = CRM_Utils_Token::replaceDomainTokens($text, $domain, TRUE, $tokens['text'], TRUE);
    $html    = CRM_Utils_Token::replaceDomainTokens($html, $domain, TRUE, $tokens['html'], TRUE);
CRM_Core_Error::debug_log_message("MSGTMPLPHP POINT   6 !!!!!!!!!!!!!");
    if ($contactID) {
    CRM_Core_Error::debug_log_message("MSGTMPLPHP POINT   7 !!!!!!!!!!!!!");
      $subject = CRM_Utils_Token::replaceContactTokens($subject, $contact, FALSE, $tokens['text'], FALSE, TRUE);
      $text    = CRM_Utils_Token::replaceContactTokens($text, $contact, FALSE, $tokens['text'], FALSE, TRUE);
      $html    = CRM_Utils_Token::replaceContactTokens($html, $contact, FALSE, $tokens['html'], FALSE, TRUE);


      $contactArray = array($contactID => $contact);
      CRM_Core_Error::debug_log_message("MSGTMPLPHP POINT   8 !!!!!!!!!!!!!");
      CRM_Utils_Hook::tokenValues($contactArray,
        array($contactID),
        NULL,
        CRM_Utils_Token::flattenTokens($tokens),
        // we should consider adding groupName and valueName here
        'CRM_Core_BAO_MessageTemplate'
      );
      $contact = $contactArray[$contactID];

      $subject = CRM_Utils_Token::replaceHookTokens($subject, $contact, $categories, TRUE);
      $text    = CRM_Utils_Token::replaceHookTokens($text, $contact, $categories, TRUE);
      $html    = CRM_Utils_Token::replaceHookTokens($html, $contact, $categories, TRUE);
      CRM_Core_Error::debug_log_message("MSGTMPLPHP POINT   9 !!!!!!!!!!!!!");
    }

    // strip whitespace from ends and turn into a single line
    $subject = "{strip}$subject{/strip}";

    // parse the three elements with Smarty
CRM_Core_Error::debug_log_message("MSGTMPLPHP POINT   10 !!!!!!!!!!!!!");

    $smarty = CRM_Core_Smarty::singleton();
    foreach ($params['tplParams'] as $name => $value) {
      $smarty->assign($name, $value);
    }
    CRM_Core_Error::debug_log_message("MSGTMPLPHP POINT   11 !!!!!!!!!!!!!");
    foreach (array(
      'subject', 'text', 'html') as $elem) {
      $$elem = $smarty->fetch("string:{$$elem}");
    }
CRM_Core_Error::debug_log_message("MSGTMPLPHP POINT   12 !!!!!!!!!!!!!");
    // send the template, honouring the target user’s preferences (if any)
    $sent = FALSE;

    // create the params array
    $params['subject'] = $subject;
    $params['text']    = $text;
    $params['html']    = $html;
CRM_Core_Error::debug_log_message("MSGTMPLPHP POINT   13 !!!!!!!!!!!!!");
    if ($params['toEmail']) {
    CRM_Core_Error::debug_log_message("MSGTMPLPHP POINT6!!!!!!!!!!!!!");
      $contactParams = array(array('email', 'LIKE', $params['toEmail'], 0, 1));
      list($contact, $_) = CRM_Contact_BAO_Query::apiQuery($contactParams);

      $prefs = array_pop($contact);

      if (isset($prefs['preferred_mail_format']) and $prefs['preferred_mail_format'] == 'HTML') {
        $params['text'] = NULL;
      }

      if (isset($prefs['preferred_mail_format']) and $prefs['preferred_mail_format'] == 'Text') {
        $params['html'] = NULL;
      }

      $config = CRM_Core_Config::singleton();
      $pdf_filename = '';
      if ($config->doNotAttachPDFReceipt &&
        $params['PDFFilename'] &&
        $params['html']
      ) {
        $pdf_filename = $config->templateCompileDir . CRM_Utils_File::makeFileName($params['PDFFilename']);

        //FIXME : CRM-7894
        //xmlns attribute is required in XHTML but it is invalid in HTML,
        //Also the namespace "xmlns=http://www.w3.org/1999/xhtml" is default,
        //and will be added to the <html> tag even if you do not include it.
        $html = preg_replace('/(<html)(.+?xmlns=["\'].[^\s]+["\'])(.+)?(>)/', '\1\3\4', $params['html']);

        file_put_contents($pdf_filename, CRM_Utils_PDF_Utils::html2pdf($html,
            $params['PDFFilename'],
            TRUE,
            $format
          )
        );

        if (empty($params['attachments'])) {
          $params['attachments'] = array();
        }
        $params['attachments'][] = array(
          'fullPath' => $pdf_filename,
          'mime_type' => 'application/pdf',
          'cleanName' => $params['PDFFilename'],
        );
      }
CRM_Core_Error::debug_log_message("MSGTMPLPHP POINT7!!!!!!!!!!!!!");
      $sent = CRM_Utils_Mail::send($params);

      if ($pdf_filename) {
        unlink($pdf_filename);
      }
    }

    return array($sent, $subject, $text, $html);
  }
}

And the log output is as follows:

Code: [Select]
May 02 23:27:09  [info] Contribution record updated successfully

May 02 23:27:09  [info] HAKAN RULES!!!!!!!!!!!!!

May 02 23:27:09  [info] HAKAN EMAILS!!!!!!!!!!!!!

May 02 23:27:09  [info] EVENTPHP SENDMAIL!!!!!!!!!!!!!

May 02 23:27:09  [info] EVENTPHP POINT1!!!!!!!!!!!!!

May 02 23:27:09  [info] EVENTPHP POINT3!!!!!!!!!!!!!

May 02 23:27:09  [info] EVENTPHP POINT4!!!!!!!!!!!!!

May 02 23:27:09  [info] EVENTPHP POINT5!!!!!!!!!!!!!

May 02 23:27:09  [info] EVENTPHP POINT7!!!!!!!!!!!!!

May 02 23:27:09  [info] MSGTMPLPHP POINT1!!!!!!!!!!!!!

May 02 23:27:09  [info] MSGTMPLPHP POINT3!!!!!!!!!!!!!

May 02 23:27:09  [info] MSGTMPLPHP POINT5!!!!!!!!!!!!!

May 02 23:27:09  [info] MSGTMPLPHP POINT   1 !!!!!!!!!!!!!

May 02 23:27:09  [info] MSGTMPLPHP POINT   2 !!!!!!!!!!!!!

May 02 23:27:09  [info] MSGTMPLPHP POINT   3 !!!!!!!!!!!!!

May 02 23:27:09  [info] MSGTMPLPHP POINT   4 !!!!!!!!!!!!!

May 02 23:27:09  [info] MSGTMPLPHP POINT   5 !!!!!!!!!!!!!

May 02 23:27:09  [info] MSGTMPLPHP POINT   6 !!!!!!!!!!!!!

May 02 23:27:09  [info] MSGTMPLPHP POINT   7 !!!!!!!!!!!!!

May 02 23:27:09  [info] MSGTMPLPHP POINT   8 !!!!!!!!!!!!!

May 02 23:27:09  [info] MSGTMPLPHP POINT   9 !!!!!!!!!!!!!

May 02 23:27:09  [info] MSGTMPLPHP POINT   10 !!!!!!!!!!!!!

May 02 23:27:09  [info] MSGTMPLPHP POINT   11 !!!!!!!!!!!!!

May 02 23:27:20  [info] returning since contribution has already been handled

So something is happening at the following (lines 464 to 467, on the original MessageTemplates.php file):

Code: [Select]
    foreach (array(
      'subject', 'text', 'html') as $elem) {
      $$elem = $smarty->fetch("string:{$$elem}");
    }

As I should have gotten the rest of the debug messages logged, but the script seems to have crashed here or something. And yes, the IPN is sent properly and the participant is marked Registered (only for a single person registration).

Any help is greatly appreciated.

Regards,

Hakan
« Last Edit: May 02, 2013, 10:40:28 pm by hakanuner »

aglozier

  • I post frequently
  • ***
  • Posts: 135
  • Karma: 9
    • Phoenix Academy
  • CiviCRM version: 4.7.9
  • CMS version: WordPress 4.6.1
  • MySQL version: 5.7.14
  • PHP version: 5.6.21
Re: No event confirmation email sent from Civi after online reg w/ PayPal Standard
May 03, 2013, 02:49:00 pm
For what it's worth, I just tested an event registration on our website using the PayPal Standard Sandbox.  The registration processed correctly and a confirmation email was sent.

MulderDSM

  • I post occasionally
  • **
  • Posts: 100
  • Karma: 0
  • CiviCRM version: 4.6.0
  • CMS version: Joomla 3.4.1
Re: No event confirmation email sent from Civi after online reg w/ PayPal Standard
August 16, 2013, 07:22:53 am
I was having this problem with a client on 4.2.7 and upgraded to 4.2.10 and still the same issue.

If you register for an event and click on pay later, CiviCRM processes registration and sends a confirmation email to us and to person registering.

If you register for an event and click on pay with PayPal (standard), CIVICRM processes registration correctly, sends you to PayPal, you complete PayPal process but a confirmation email from CIVICRM is never emailed to us or the person registering, they only have the PayPal receipt unless I manually generate a receipt.

Client isn't ready to move to 4.3, and if moving to 4.2.10 didn't fix, why would I think that 4.3 would fix. Any other tweaks or patches that I could do to fix???

Guy Iaccarino

  • I post occasionally
  • **
  • Posts: 92
  • Karma: 5
    • Greenleaf Advancement
  • CiviCRM version: 4.4.10, 4.5.4
  • CMS version: WordPress 4, Drupal 7, Drupal 6, Joomla 3
  • MySQL version: 5.5
  • PHP version: 5.3
Re: No event confirmation email sent from Civi after online reg w/ PayPal Standard
August 21, 2013, 07:48:57 am
total shot in the dark here - but when we were having problems with unsubscribes, lobo pointed out that we couldn't use the email of an administrator, and that in fact was the issue - when we used emails of an admin, the unsubscribe wouldn't work (though I don't know why from a code perspective), but when we used the address of someone who wasn't an admin, it did work. Are you making all the contributions logged in as an admin? If so, is it worth a shot to try it either anonymously or while logged in as someone who isn't an admin?
Guy Iaccarino
www.greenleafadvancement.com

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • No event confirmation email sent from Civi after online reg w/ PayPal Standard

This forum was archived on 2017-11-26.