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 CiviMail (Moderator: Piotr Szotkowski) »
  • ** Solved ** Membership Reminders
Pages: [1]

Author Topic: ** Solved ** Membership Reminders  (Read 1712 times)

brandenallmon

  • Guest
** Solved ** Membership Reminders
April 05, 2010, 04:54:17 pm
I see an activity report for email reminders, but none of the people received the email. I know email works as the membership confirmations go out to the same people. Any ideas are appreciated.

Branden
« Last Edit: April 09, 2010, 08:10:40 am by brandenallmon »

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Membership Reminders
April 05, 2010, 04:59:23 pm
There is a 'from address' hard coded in the e-mail reminder cron job file - is it correct?
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

brandenallmon

  • Guest
Re: Membership Reminders
April 08, 2010, 10:28:01 am
I don't see a hard coded email in the civimail.cronjob.php


function processQueue( ) {
require_once 'CRM/Mailing/BAO/Job.php';
CRM_Mailing_BAO_Job::runJobs();
}

function run( ) {
session_start( );

require_once '../civicrm.config.php';
require_once 'CRM/Core/Config.php';

$config =& CRM_Core_Config::singleton();

// this does not return on failure
CRM_Utils_System::authenticateScript( true );

// we now use DB locks on a per job basis
processQueue( );
}

run( );

brandenallmon

  • Guest
Re: Membership Reminders
April 08, 2010, 11:30:03 am
Also it looks like the membership renewal reminders is handled by the UpdateMembershipRecord.php, it  updates the records to indicate an email was sent, but no email is going out.

Branden

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Membership Reminders
April 08, 2010, 01:18:27 pm
Yes, I was referring to updatemembership.php

Just checking you edited these lines in it:

                   
                    if ( $toEmail ) {
                        // Set the FROM email address for reminder emails here.
                        // This must be a valid account for your SMTP service.
                        $from = "EMAIL@FIXME.ORG";
                        $result = CRM_Core_BAO_MessageTemplates::sendReminder( $dao->contact_id,
 
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Membership Reminders
April 08, 2010, 01:25:36 pm
I haven't tested this but this might change it to use the default 'from' e-mail rather than a hard coded one

Index: bin/UpdateMembershipRecord.php.txt
===================================================================
--- bin/UpdateMembershipRecord.php.txt   (revision 26715)
+++ bin/UpdateMembershipRecord.php.txt   (working copy)
@@ -67,7 +67,7 @@
     
     public function updateMembershipStatus( )
     {
-   $config =& CRM_Core_Config::singleton();   
+    $config =& CRM_Core_Config::singleton();   
         //get all active statuses of membership, CRM-3984
         $allStatus = CRM_Member_PseudoConstant::membershipStatus( );
         $allTypes  = CRM_Member_PseudoConstant::membershipType( );
@@ -205,13 +205,23 @@
                     $toEmail  = CRM_Contact_BAO_Contact::getPrimaryEmail( $dao->contact_id );
                     
                     if ( $toEmail ) {
-                        // Set the FROM email address for reminder emails here.
-                        // This must be a valid account for your SMTP service.
-                        $from = "EMAIL@FIXME.ORG";
+                        //set default from email address.
+                        require_once 'CRM/Core/OptionGroup.php';
+                        if ( CRM_Utils_Array::value( 'from_name', $defaults ) && CRM_Utils_Array::value( 'from_email', $defaults ) ) {
+               
+                            $defaults['from_email_address'] = array_search( '"' . $defaults['from_name'] . '"<' . $defaults['from_email'] . '>',
+                                                                CRM_Core_OptionGroup::values( 'from_email_address' ) );               
+                        } else {
+                            //get the default from email address.
+                            $defaultAddress = CRM_Core_OptionGroup::values( 'from_email_address', null, null, null, ' AND is_default = 1' );
+                            foreach ( $defaultAddress as $id => $value ) {
+                            $defaults['from_email_address'] = $id;
+                      }
+            }
                         $result = CRM_Core_BAO_MessageTemplates::sendReminder( $dao->contact_id,
                                                                                $toEmail,
                                                                                $memType->renewal_msg_id,
-                                                                               $from );
+                                                                               $defaults['from_email_address']);
                         if ( ! $result ||
                              is_a( $result, 'PEAR_Error' ) ) {
                             // we could not send an email, for now we ignore
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

brandenallmon

  • Guest
Re: Membership Reminders
April 09, 2010, 08:10:15 am
It was the UpdateMembershipRecord.php from email address. Thank you!!!

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: ** Solved ** Membership Reminders
April 09, 2010, 01:27:26 pm
Cool - don't suppose you want to see if that patch I posted works? If it does then you wouldn't need to configure it in the script & re-configure each upgrade. Otherwise I'll test it when I get a chance...
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

brandenallmon

  • Guest
Re: ** Solved ** Membership Reminders
April 13, 2010, 07:54:55 pm
I'll try your patch. It is giving me more fun now. It is stripping the content from the mail if they are over a certain character limit. Not sure what is going on now.

Thank you for your help!!!

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: ** Solved ** Membership Reminders
April 13, 2010, 07:55:38 pm
I have a modified one...
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: ** Solved ** Membership Reminders
April 13, 2010, 07:56:19 pm
Index: bin/UpdateMembershipRecord.php.txt
===================================================================
--- bin/UpdateMembershipRecord.php.txt   (revision 26715)
+++ bin/UpdateMembershipRecord.php.txt   (working copy)
@@ -67,7 +67,7 @@
     
     public function updateMembershipStatus( )
     {
-   $config =& CRM_Core_Config::singleton();   
+    $config =& CRM_Core_Config::singleton();   
         //get all active statuses of membership, CRM-3984
         $allStatus = CRM_Member_PseudoConstant::membershipStatus( );
         $allTypes  = CRM_Member_PseudoConstant::membershipType( );
@@ -205,13 +205,14 @@
                     $toEmail  = CRM_Contact_BAO_Contact::getPrimaryEmail( $dao->contact_id );
                     
                     if ( $toEmail ) {
-                        // Set the FROM email address for reminder emails here.
-                        // This must be a valid account for your SMTP service.
-                        $from = "EMAIL@FIXME.ORG";
+                        //set default from email address.
+                             //get the default from email address.
+                            $from = CRM_Core_OptionGroup::values( 'from_email_address', null, null, null, ' AND is_default = 1' );
+                       
                         $result = CRM_Core_BAO_MessageTemplates::sendReminder( $dao->contact_id,
                                                                                $toEmail,
                                                                                $memType->renewal_msg_id,
-                                                                               $from );
+                                                                               $from);
                         if ( ! $result ||
                              is_a( $result, 'PEAR_Error' ) ) {
                             // we could not send an email, for now we ignore
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMail (Moderator: Piotr Szotkowski) »
  • ** Solved ** Membership Reminders

This forum was archived on 2017-11-26.