Example #1
0
 public function SendMessage()
 {
     // Set debug mode
     //QEmailServer::$TestMode = true;
     //QEmailServer::$TestModeDirectory = __DOCROOT__ . '/../file_assets/emails';
     QEmailServer::$SmtpServer = SMTP_SERVER;
     // Create a new message
     // Note that you can list multiple addresses and that Qcodo supports Bcc and Cc
     if ($this->objPrayerRequest) {
         $objMessage = new QEmailMessage();
         $objMessage->From = 'info@alcf.net <*****@*****.**>';
         $objMessage->To = $this->objPrayerRequest->Email;
         $objMessage->Subject = $this->txtSubject->Text;
         // Setup Plaintext Message
         $strBody = "Dear " . $this->objPrayerRequest->Name . ",\r\n\r\n";
         $strBody .= sprintf("Someone has sent you a note of encouragement regarding your prayer request.");
         $strBody .= sprintf("\r\nYou can view their note below.");
         $strBody .= '\\r\\nRegards, \\r\\nALCF Communications\\r\\n\\r\\n';
         $strBody .= $this->txtNote->Text;
         $objMessage->Body = $strBody;
         // Also setup HTML message (optional)
         $strBody = "Dear " . $this->objPrayerRequest->Name . ',<br/><br/>';
         $strBody .= sprintf("Someone has sent you a note of encouragement regarding your prayer request.");
         $strBody .= sprintf("<br>You can view their note below.");
         $strBody .= '<br>Regards,<br/><b>ALCF Communications</b><br><br>';
         $strBody .= '<p>' . $this->txtNote->Text . '</p>';
         $objMessage->HtmlBody = $strBody;
         // Add random/custom email headers
         $objMessage->SetHeader('x-application', 'Communications Team');
         QEmailServer::Send($objMessage);
         return 1;
     } else {
         return 0;
     }
 }
Example #2
0
 public function Send()
 {
     $objMessage = new QEmailMessage();
     $objMessage->From = $this->FromAddress;
     $objMessage->To = $this->ToAddress;
     $objMessage->Subject = $this->Subject;
     $objMessage->Body = $this->Body;
     $objMessage->HtmlBody = $this->Html;
     try {
         QEmailServer::Send($objMessage);
         $this->Delete();
     } catch (QCallerException $objExc) {
         $this->ErrorMessage = $objExc->getMessage();
         $this->ErrorFlag = true;
         $this->Save();
     }
 }
Example #3
0
 public function Send()
 {
     if (!$this->blnErrorFlag) {
         $this->blnErrorFlag = true;
         $this->Save();
         $objEmailMessage = new QEmailMessage($this->strFromAddress, $this->strToAddress, $this->strSubject, $this->strBody);
         $objEmailMessage->Cc = $this->strCcAddress;
         $objEmailMessage->Bcc = $this->strBccAddress;
         try {
             QEmailServer::Send($objEmailMessage);
         } catch (QCallerException $objExc) {
             QLog::Log('Email Failed to Send #' . $this->intId);
             QLog::Log($objExc->getMessage());
             $this->strErrorMessage = $objExc->getMessage();
             $this->Save();
         }
         $this->Delete();
     }
 }
Example #4
0
 public function Send()
 {
     // Do **NOT** send again if it has already been sent!
     if ($this->dttDateSent) {
         return;
     }
     // Store an array of email addresses (SMS-based) to send to
     $strBccArray = array();
     // Get the Group, and get the array for CcArray
     $intPersonIdArray = array();
     foreach ($this->Group->GetActiveGroupParticipationArray() as $objGroupParticipation) {
         // ONly at most one per person
         if (!array_key_exists($objGroupParticipation->PersonId, $intPersonIdArray)) {
             // Get the Person
             $objPerson = $objGroupParticipation->Person;
             // Do we have an SMS?
             if ($objPhone = $objPerson->GetSmsEnabledPhone()) {
                 // Yep!  Add it to the list
                 $strBccArray[] = $objPhone->SmsEmailAddress;
             }
             // Finally, let's make sure it only gets sent (at most) once per person
             $intPersonIdArray[$objGroupParticipation->PersonId] = $objGroupParticipation->PersonId;
         }
     }
     // Do we have any to send to?
     if (count($strBccArray)) {
         // Yes -- let's send it
         $objEmailMessage = new QEmailMessage($this->Login->Email, $this->Login->Email, $this->strSubject, $this->strBody);
         $objEmailMessage->Bcc = implode(', ', $strBccArray);
         QEmailServer::Send($objEmailMessage);
         $this->DateSent = QDateTime::Now();
         $this->Save();
     } else {
         // No -- let's report it
         $objEmailMessage = new QEmailMessage($this->Login->Email, $this->Login->Email, '[Failed to Send] ' . $this->strSubject, 'The following SMS did NOT send because there were no SMS-enabled group participants: ' . $this->strBody);
         QEmailServer::Send($objEmailMessage);
         $this->Delete();
     }
 }
 public function btnRecoverPassword_Click($strFormId, $strControlId, $strParameter)
 {
     if ($this->txtEmail->Text) {
         $objUser = NarroUser::QuerySingle(QQ::Equal(QQN::NarroUser()->Email, $this->txtEmail->Text));
     } elseif ($this->txtUsername->Text) {
         $objUser = NarroUser::QuerySingle(QQ::Equal(QQN::NarroUser()->Username, $this->txtUsername->Text));
     } else {
         $this->lblMessage->ForeColor = 'red';
         $this->lblMessage->Text = t('Please enter a username or email to continue.');
         return false;
     }
     if ($objUser instanceof NarroUser) {
         if ($objUser->UserId == NarroUser::ANONYMOUS_USER_ID) {
             $this->lblMessage->ForeColor = 'red';
             $this->lblMessage->Text = t('Hey, the anonymous user doesn\'t have a password. What are you trying to do?');
             return false;
         }
         $objMessage = new QEmailMessage();
         $objMessage->From = sprintf('%s <%s>', __FROM_EMAIL_NAME__, __FROM_EMAIL_ADDRESS__);
         $objMessage->To = sprintf('%s <%s>', $objUser->Username, $objUser->Email);
         $objMessage->Subject = sprintf('Password recovery for "%s" on "%s"', $objUser->Username, $_SERVER['HTTP_HOST']);
         $objMessage->Body = sprintf('Somebody, probably you, requested a password recovery for "%s" on "%s". To change your password, please follow this link: %s', $objUser->Username, $_SERVER['HTTP_HOST'], (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . __VIRTUAL_DIRECTORY__ . __SUBDIRECTORY__ . sprintf('/change_password.php?l=%s&u=%s&h=%s', QApplication::$TargetLanguage->LanguageCode, $objUser->Username, $objUser->Password));
         try {
             QEmailServer::Send($objMessage);
             $this->lblMessage->ForeColor = 'green';
             $this->lblMessage->Text = t('You should have a new email message with instructions. Check your spam/bulk directory too.');
         } catch (Exception $objEx) {
             $this->lblMessage->ForeColor = 'red';
             $this->lblMessage->Text = t('Failed to send email. This may be a server issue. Please try again later.');
             return false;
         }
     } else {
         $this->lblMessage->ForeColor = 'red';
         $this->lblMessage->Text = t('Bad username or/and email');
     }
 }
if (defined('ERROR_LOG_PATH') && ERROR_LOG_PATH && defined('ERROR_LOG_FLAG') && ERROR_LOG_FLAG) {
    // Log to File in ERROR_LOG_PATH
    $strContents = ob_get_contents();
    QApplication::MakeDirectory(ERROR_LOG_PATH, 0777);
    $strFileName = ERROR_LOG_PATH . '/' . date('Y-m-d-H-i-s-' . rand(100, 999)) . '.html';
    file_put_contents($strFileName, $strContents);
    @chmod($strFileName, 0666);
}
if (defined('ERROR_EMAIL')) {
    $objEmail = new QEmailMessage();
    $objEmail->From = ERROR_EMAIL_FROM;
    $objEmail->Subject = ERROR_EMAIL_SUBJECT;
    $objEmail->To = ERROR_EMAIL;
    $strContents = ob_get_contents();
    $objEmail->HtmlBody = $strContents;
    QEmailServer::Send($objEmail);
}
if (QApplication::$RequestMode == QRequestMode::Ajax) {
    if (defined('ERROR_FRIENDLY_AJAX_MESSAGE') && ERROR_FRIENDLY_AJAX_MESSAGE) {
        // Reset the Buffer
        while (ob_get_level()) {
            ob_end_clean();
        }
        //$strAlertMsg = str_replace('"', '\\"', ERROR_FRIENDLY_AJAX_MESSAGE);
        $strMsg = str_replace('\\r\\n', '<br />', ERROR_FRIENDLY_AJAX_MESSAGE);
        echo '<p>' . $strMsg . '</p>';
    }
} else {
    if (defined('ERROR_FRIENDLY_PAGE_PATH') && ERROR_FRIENDLY_PAGE_PATH) {
        // Reset the Buffer
        while (ob_get_level()) {
Example #7
0
 public function SendMessage()
 {
     // Set debug mode
     //QEmailServer::$TestMode = true;
     //QEmailServer::$TestModeDirectory = __DOCROOT__ . '/../file_assets/emails';
     QEmailServer::$SmtpServer = SMTP_SERVER;
     // Create a new message
     // Note that you can list multiple addresses and that Qcodo supports Bcc and Cc
     $objMessage = new QEmailMessage();
     $objMessage->From = 'info@alcf.net <*****@*****.**>';
     $objMessage->To = $this->txtEmail->Text;
     $objMessage->Subject = 'Your Praise testimony has been successfuly submitted.';
     // Setup Plaintext Message
     $strBody = "Dear " . $this->txtName->Text . ",\r\n\r\n";
     $strBody .= sprintf("You have successfully submitted your praise testimony.");
     $strBody .= sprintf("\r\nYou can view your praise testimony by selecting the 'Praises and Thanks' button in the prayer room.");
     $strBody .= '\\r\\nRegards, \\r\\nALCF Communications';
     $objMessage->Body = $strBody;
     // Also setup HTML message (optional)
     $strBody = "Dear " . $this->txtName->Text . ',<br/><br/>';
     $strBody .= sprintf("You have successfully submitted your praise testimony.");
     $strBody .= sprintf("<br>You can view your praise testimony by selecting the 'Praises and Thanks' button in the prayer room.");
     $strBody .= '<br>Regards,<br/><b>ALCF Communications</b>';
     $objMessage->HtmlBody = $strBody;
     // Add random/custom email headers
     $objMessage->SetHeader('x-application', 'Communications Team');
     QEmailServer::Send($objMessage);
 }
Example #8
0
 public function SendMessage()
 {
     // Set debug mode
     //QEmailServer::$TestMode = true;
     //QEmailServer::$TestModeDirectory = __DOCROOT__ . '/../file_assets/emails';
     QEmailServer::$SmtpServer = SMTP_SERVER;
     // Create a new message
     // Note that you can list multiple addresses and that Qcodo supports Bcc and Cc
     $objMessage = new QEmailMessage();
     $objMessage->From = 'Carisa Hamilton <*****@*****.**>';
     $objMessage->To = $this->objGroupRegistration->Email;
     $objMessage->Bcc = '*****@*****.**';
     $objMessage->Subject = 'Invitation to Growth Groups';
     // Setup Plaintext Message
     $strBody = "Hello " . $this->objGroupRegistration->FirstName . "!\r\n\r\n";
     $strBody .= 'We are very excited that you are interested in facilitating a Growth Group! \\r\\nAttached is a ' . 'facilitator application we ask all potential facilitators to complete. \\r\\n' . 'Please fill it out and send it back to me via email (carisa.hamilton@alcf.net). \\r\\nYou may also fax ' . 'it to the church office at 650-625-1500 or drop it off in the All Forms Box at the worship ' . 'center. \\r\\nOnce we receive your application, Pastor John will follow up with you for a short ' . 'interview.\\r\\n';
     $strBody .= 'If you have any questions or concerns please feel free to contact me.\\r\\n\\r\\n';
     $strBody .= 'Blessings,\\r\\n Carisa';
     $objMessage->Body = $strBody;
     // Also setup HTML message (optional)
     $strBody = "Hello " . $this->objGroupRegistration->FirstName . "!<br><br>";
     $strBody .= 'We are very excited that you are interested in facilitating a Growth Group! <br>Attached is a ' . 'facilitator application we ask all potential facilitators to complete. <br>' . 'Please fill it out and send it back to me via email (carisa.hamilton@alcf.net). <br>You may also fax ' . 'it to the church office at 650-625-1501 or drop it off in the All Forms Box at the worship ' . 'center. <br>Once we receive your application, Pastor John will follow up with you for a short ' . 'interview.<br><br>';
     $strBody .= 'If you have any questions or concerns please feel free to contact me.<br><br>';
     $strBody .= 'Blessings,<br> Carisa';
     $objMessage->HtmlBody = $strBody;
     // Add the attachment
     $objFile = new QEmailAttachment(__DOCROOT__ . '/../file_assets/FacilitatorApplication.doc');
     $objMessage->AddAttachment($objFile);
     // Add random/custom email headers
     $objMessage->SetHeader('x-application', 'Growth Groups Ministry');
     QEmailServer::Send($objMessage);
 }
Example #9
0
 public function SendNotification()
 {
     $objPerson = Person::Load($this->objPersonId);
     $email = '';
     if ($objPerson->PrimaryEmail->Address) {
         $email = $objPerson->PrimaryEmail->Address;
     } else {
         $email = $objPerson->_Email->Address;
     }
     // Set debug mode
     //QEmailServer::$TestMode = true;
     //QEmailServer::$TestModeDirectory = __DOCROOT__ . '/../file_assets/emails';
     QEmailServer::$SmtpServer = SMTP_SERVER;
     // Create a new message
     // Note that you can list multiple addresses and that Qcodo supports Bcc and Cc
     $objMessage = new QEmailMessage();
     $objMessage->From = 'Christina Alo <*****@*****.**>';
     $objMessage->To = 'Christina <*****@*****.**>';
     $objMessage->Subject = 'Notification of Exiting Members';
     // Setup Plaintext Message
     $strBody = "Hello Administrator (Christina)!\r\n\r\n";
     $strBody .= 'r\\n';
     $strBody .= 'Someone just unsubscribed from the church newsletter and closed their membership.\\r\\n\\r\\n';
     $strBody .= sprintf("Their Details:\r\n%s %s\r\nemail: %s \r\n\r\n", $objPerson->FirstName, $objPerson->LastName, $email);
     $strBody .= 'Blessings,\\r\\n Noah.';
     $objMessage->Body = $strBody;
     // Also setup HTML message (optional)
     $strBody = "Hello Administrator (Christina)!<br><br>";
     $strBody .= 'Someone just unsubscribed from the church newsletter and closed their membership.<br><br>';
     $strBody .= sprintf("Their Details:<br>%s %s<br>email: %s<br><br>", $objPerson->FirstName, $objPerson->LastName, $email);
     $strBody .= 'Blessings,<br> Noah.';
     $objMessage->HtmlBody = $strBody;
     // Add random/custom email headers
     $objMessage->SetHeader('x-application', 'Church Newsletter Administration');
     QEmailServer::Send($objMessage);
 }
 public function SendMessage()
 {
     $facilitatorList = array();
     $groupInfo = array();
     // Get information for each selected group
     foreach ($this->rbtnSelectArray as $rbtnSelect) {
         if ($rbtnSelect->Checked) {
             $objGroup = Group::Load($rbtnSelect->ActionParameter);
             $objGroupParticipants = GroupParticipation::LoadArrayByGroupId($objGroup->Id);
             $bFoundContact = false;
             // Check for Contact person first
             foreach ($objGroupParticipants as $objParticipant) {
                 if ($objParticipant->GroupRoleId == $this->intGroupContactRoleId && $objParticipant->DateEnd == null) {
                     $objContact = Person::Load($objParticipant->PersonId);
                     $facilitatorList[] = $objContact;
                     $bFoundContact = true;
                     break;
                 }
             }
             // If contact person not found, grab facilitator
             if (!$bFoundContact) {
                 foreach ($objGroupParticipants as $objParticipant) {
                     if ($objParticipant->GroupRoleId == $this->intFacilitatorRoleId && $objParticipant->DateEnd == null) {
                         $objFacilitator = Person::Load($objParticipant->PersonId);
                         $facilitatorList[] = $objFacilitator;
                         break;
                     }
                 }
             }
             $ggGroup = GrowthGroup::Load($rbtnSelect->ActionParameter);
             $groupInfo[] = array(trim(str_replace(range(0, 9), '', $objGroup->Name)), $ggGroup->MeetingInfo);
         }
     }
     // Set debug mode
     //QEmailServer::$TestMode = true;
     //QEmailServer::$TestModeDirectory = __DOCROOT__ . '/../file_assets/emails';
     QEmailServer::$SmtpServer = SMTP_SERVER;
     // Create a new message
     // Note that you can list multiple addresses and that Qcodo supports Bcc and Cc
     $objMessage = new QEmailMessage();
     $objMessage->From = 'Carisa Hamilton <*****@*****.**>';
     $objMessage->To = $this->objRegistrant->Email;
     $objMessage->Bcc = '*****@*****.**';
     $objMessage->Subject = 'Invitation to Growth Groups';
     // Setup Plaintext Message
     $strBody = "Dear " . $this->objRegistrant->FirstName . ",\r\n\r\n";
     $strBody .= "Thank you for your interest in Growth Groups! Below is the information for one or more Growth Groups in your area. Please contact the facilitators below for more information about visiting. I've copied them on this e-mail so that they will know of your interest.\r\n\r\n";
     $strBody .= sprintf("%s %s\r\n%s\r\n%s\r\n\r\n", $this->objRegistrant->FirstName, $this->objRegistrant->LastName, $this->objRegistrant->Phone, $this->objRegistrant->Email);
     if (count($groupInfo) >= 1) {
         if ($facilitatorList[0]->PrimaryEmailId == null) {
             $emailArray = Email::LoadArrayByPersonId($facilitatorList[0]->Id);
             $email = $emailArray[0]->Address;
             // just grab the first one we find
         } else {
             $email = Email::Load($facilitatorList[0]->PrimaryEmailId)->Address;
         }
         $strBody .= sprintf("%s, %s \r\\Contact: %s %s\r\n%s\r\n\r\n", $groupInfo[0][0], $groupInfo[0][1], $facilitatorList[0]->FirstName, $facilitatorList[0]->LastName, $email);
         $objMessage->Cc = $email;
     }
     if (count($groupInfo) >= 2) {
         if ($facilitatorList[1]->PrimaryEmailId == null) {
             $emailArray = Email::LoadArrayByPersonId($facilitatorList[1]->Id);
             $email = $emailArray[0]->Address;
             // just grab the first one we find
         } else {
             $email = Email::Load($facilitatorList[1]->PrimaryEmailId)->Address;
         }
         $strBody .= sprintf("%s, %s \r\\Contact: %s %s\r\n%s\r\n\r\n", $groupInfo[1][0], $groupInfo[1][1], $facilitatorList[1]->FirstName, $facilitatorList[1]->LastName, $email);
         $objMessage->Cc .= ', ' . $email;
     }
     if (count($groupInfo) >= 3) {
         if ($facilitatorList[1]->PrimaryEmailId == null) {
             $emailArray = Email::LoadArrayByPersonId($facilitatorList[2]->Id);
             $email = $emailArray[0]->Address;
             // just grab the first one we find
         } else {
             $email = Email::Load($facilitatorList[2]->PrimaryEmailId)->Address;
         }
         $strBody .= sprintf("%s, %s \r\\Contact: %s %s\r\n%s\r\n", $groupInfo[2][0], $groupInfo[2][1], $facilitatorList[2]->FirstName, $facilitatorList[2]->LastName, $email);
         $objMessage->Cc .= ', ' . $email;
     }
     $strBody .= '\\r\\n* Please don\'t hesitate to visit a group for 2 to 3 times before prayerfully deciding if the ' . 'group is a good fit for you.\\r\\n\\r\\n';
     $strBody .= 'Regards, \\r\\nCarisa Hamilton';
     $objMessage->Body = $strBody;
     // Also setup HTML message (optional)
     $strBody = "Dear " . $this->objRegistrant->FirstName . ',<br/><br/>';
     $strBody .= 'Thank you for your interest in Growth Groups! Below is the information for one or more Growth Groups ' . 'in your area. <br>Please contact the facilitators below for more information about visiting. ' . 'I have copied them on this e-mail so that they will know of your interest.<br><br>';
     $strBody .= sprintf("%s %s<br>%s<br>%s<br><br>", $this->objRegistrant->FirstName, $this->objRegistrant->LastName, $this->objRegistrant->Phone, $this->objRegistrant->Email);
     if (count($groupInfo) >= 1) {
         if ($facilitatorList[0]->PrimaryEmailId == null) {
             $emailArray = Email::LoadArrayByPersonId($facilitatorList[0]->Id);
             $email = $emailArray[0]->Address;
             // just grab the first one we find
         } else {
             $email = Email::Load($facilitatorList[0]->PrimaryEmailId)->Address;
         }
         $strBody .= sprintf("<b>Option 1</b><br>%s, %s<br>Contact: %s %s<br>%s<br><br>", $groupInfo[0][0], $groupInfo[0][1], $facilitatorList[0]->FirstName, $facilitatorList[0]->LastName, $email);
         $objMessage->Cc .= ', ' . $email;
     }
     if (count($groupInfo) >= 2) {
         if ($facilitatorList[1]->PrimaryEmailId == null) {
             $emailArray = Email::LoadArrayByPersonId($facilitatorList[1]->Id);
             $email = $emailArray[0]->Address;
             // just grab the first one we find
         } else {
             $email = Email::Load($facilitatorList[1]->PrimaryEmailId)->Address;
         }
         $strBody .= sprintf("<b>Option 2</b><br>%s, %s <br><b>Contact:</b> %s %s<br>%s<br><br>", $groupInfo[1][0], $groupInfo[1][1], $facilitatorList[1]->FirstName, $facilitatorList[1]->LastName, $email);
         $objMessage->Cc .= ', ' . $email;
     }
     if (count($groupInfo) >= 3) {
         if ($facilitatorList[1]->PrimaryEmailId == null) {
             $emailArray = Email::LoadArrayByPersonId($facilitatorList[2]->Id);
             $email = $emailArray[0]->Address;
             // just grab the first one we find
         } else {
             $email = Email::Load($facilitatorList[2]->PrimaryEmailId)->Address;
         }
         $strBody .= sprintf("<b>Option 3</b><br>%s, %s <br><b>Contact:</b> %s %s<br>%s<br>", $groupInfo[2][0], $groupInfo[2][1], $facilitatorList[2]->FirstName, $facilitatorList[2]->LastName, $email);
         $objMessage->Cc .= ', ' . $email;
     }
     $strBody .= '<br>* Please don\'t hesitate to visit a group for 2 to 3 times before prayerfully deciding if the ' . 'group is a good fit for you.<br><br>';
     $strBody .= 'Regards,<br/><b>Carisa Hamilton</b>';
     $objMessage->HtmlBody = $strBody;
     // Add random/custom email headers
     $objMessage->SetHeader('x-application', 'Growth Groups Ministry');
     QEmailServer::Send($objMessage);
 }
Example #11
0
 /**
  * This will send this message in PendingSend status, given a limit of how many to send out.
  * It will first attempt to send bounces... then it will send actuals (up to the limit)
  * per token.
  * 
  * If all OutgoingMessageQueus are exhuasted for this EmailMessage, then this EmailMessage
  * status will be set to Completed, CompletedWithSomeRejections or Rejected
  * @return void
  */
 public function SendMessage($intMaxPerEmail)
 {
     // First process errors
     $objToSend = EmailOutgoingQueue::LoadArrayByEmailMessageIdErrorFlag($this->intId, true);
     foreach ($objToSend as $objEmailOutgoingQueue) {
         $objSmtpMessage = new QEmailMessage(GROUPS_SERVER_BOUNCE_EMAIL, $objEmailOutgoingQueue->ToAddress, GROUPS_SERVER_BOUNCE_SUBJECT, $this->ErrorMessage . "\r\n\r\n----- Original message -----\r\n\r\n" . $this->strRawMessage);
         QEmailServer::Send($objSmtpMessage);
         $objEmailOutgoingQueue->Delete();
     }
     // Second process successes
     $this->GetHeaderArray();
     $this->ClearHeaderValue('Subject');
     $this->ClearHeaderValue('Message-Id');
     $this->ClearHeaderValue('Message-ID');
     $this->ClearHeaderValue('Message-id');
     $this->ClearHeaderValue('message-id');
     $this->ClearHeaderValue('MESSAGE-ID');
     foreach ($this->GetEmailMessageRouteArray() as $objRoute) {
         $objToSend = EmailOutgoingQueue::LoadArrayByEmailMessageIdToken($this->Id, $objRoute->Token, QQ::LimitInfo($intMaxPerEmail));
         if (count($objToSend)) {
             $strHeaderArray = $this->strHeaderArray;
             $strSubject = $this->Subject;
             if (strpos(strtolower($strSubject), '[' . trim(strtolower($objRoute->Name)) . ']') === false) {
                 $strSubject = '[' . trim($objRoute->Name) . '] ' . $strSubject;
             }
             $strHeaderArray['Subject'] = $strSubject;
             //GJS - add a Reply-To in the header
             $strHeaderArray['Reply-To'] = $this->FromAddress;
             $strRcptToArray = array();
             foreach ($objToSend as $objEmailOutgoingQueue) {
                 if (QEmailServer::IsEmailValid($objEmailOutgoingQueue->ToAddress)) {
                     $strRcptToArray[] = $objEmailOutgoingQueue->ToAddress;
                 }
             }
             // GJS - Ensure that From address is the email of the group instead. This is to get around new email policies.
             // $this->FromAddress
             $txtFromAddress = "{$this->FromAddress}";
             // default if we can't extract the group name;
             if ($this->_EmailMessageRoute) {
                 if ($this->_EmailMessageRoute->CommunicationList) {
                     $txtFromAddress = $this->_EmailMessageRoute->CommunicationList->Token . 'groups.alcf.net';
                 } else {
                     if ($this->_EmailMessageRoute->Group->Token) {
                         $txtFromAddress = $this->_EmailMessageRoute->Group->Token . 'groups.alcf.net';
                     }
                 }
             }
             QEmailServer::SendRawMessage($txtFromAddress, $strRcptToArray, $strHeaderArray, $this->ResponseBody);
             foreach ($objToSend as $objEmailOutgoingQueue) {
                 $objEmailOutgoingQueue->Delete();
             }
         }
     }
     // Finally, update status (if applicable)
     if (!$this->CountEmailOutgoingQueues()) {
         if ($this->CountEmailMessageRoutes() && $this->ErrorMessage) {
             $this->intEmailMessageStatusTypeId = EmailMessageStatusType::CompletedWithSomeRejections;
         } else {
             if ($this->CountEmailMessageRoutes()) {
                 $this->intEmailMessageStatusTypeId = EmailMessageStatusType::Completed;
             } else {
                 $this->intEmailMessageStatusTypeId = EmailMessageStatusType::Rejected;
             }
         }
         $this->Save();
     }
 }
function sendFailureEmail($intPersonId, $intDonationId, $strCardholderName, $intCreditCardTypeId, $strAccountNumber, $strPaymentItems, $intAmount, $status)
{
    // Set debug mode
    //QEmailServer::$TestMode = true;
    //QEmailServer::$TestModeDirectory = __DOCROOT__ . '/../file_assets/emails';
    QEmailServer::$SmtpServer = SMTP_SERVER;
    $objPerson = Person::Load($intPersonId);
    $strEmail = $objPerson->GetEmailToUseForCommLists();
    // Create a new message
    // Note that you can list multiple addresses and that Qcodo supports Bcc and Cc
    $objMessage->From = 'ALCF Support <*****@*****.**>';
    $objMessage->To = $strEmail;
    $objMessage->Bcc = 'ALCF Support <*****@*****.**>';
    $objMessage->Subject = 'Notification of Recurring Payment Failure';
    // Setup Plaintext Message
    $strBody = '======= DO NOT REPLY =======\\r\\n';
    $strBody .= sprintf("Dear %s %s,\r\n\r\n", $objPerson->FirstName, $objPerson->LastName);
    $strBody .= 'r\\n';
    $strBody .= sprintf("Your (Recurring)online donation to Abundant Life Christian Fellowship.  Your transaction number is %d.  \r\n\r\n", $intDonationId);
    $strBody .= sprintf("An attempt to charge \$%01.2f on your credit card %s x%s failed.  The following is a summary of the attempted donation:\r\n", $intAmount, CreditCardType::ToString($intCreditCardTypeId), substr($strAccountNumber, strlen($strAccountNumber) - 4));
    for ($i = 0; $i < count($itemarray); $i++) {
        $strBody .= sprintf("%s\r\n", $itemarray[$i]);
    }
    $strBody .= sprintf("The failure was due to: %s\r\n", $status);
    $strBody .= "Please review your credit card details online at https://my.alcf.net, and verify that the details are correct.\r\n";
    $strBody .= "If you have any questions, please don't hesitate to call Oom Vang at 650-561-8026 or email Oom.Vang@alcf.net.\r\n";
    $strBody .= "Thank you for your continued support of the ministry at Abundant Life Christian Fellowship!\r\n\r\n";
    $strBody .= "============================<br>";
    $strBody .= "P.S. This email was sent from an unmanaged email account.  Please do not reply, as any replies to this message will bounce back.";
    $objMessage->Body = $strBody;
    // Also setup HTML message (optional)
    $strBody = '======= DO NOT REPLY =======';
    $strBody .= sprintf("Dear %s %s,<br><br>", $objPerson->FirstName, $objPerson->LastName);
    $strBody .= sprintf("Your (Recurring)online donation to Abundant Life Christian Fellowship.  Your transaction number is %d.  <br><br>", $intDonationId);
    $strBody .= sprintf("An attempt to charge %01.2f on your credit card %s x%s failed.  The following is a summary of the attempted donation:<br>", $intAmount, substr($strAccountNumber, CreditCardType::ToString($intCreditCardTypeId), strlen($strAccountNumber) - 4));
    for ($i = 0; $i < count($itemarray); $i++) {
        $strBody .= sprintf("%s<br>", $itemarray[$i]);
    }
    $strBody .= sprintf("The failure was due to: %s<br>", $status);
    $strBody .= "Please review your credit card details online at https://my.alcf.net, and verify that the details are correct.<br>";
    $strBody .= "If you have any questions, please don't hesitate to call Oom Vang at 650-561-8026 or email Oom.Vang@alcf.net.<br>";
    $strBody .= "Thank you for your continued support of the ministry at Abundant Life Christian Fellowship!<br><br>";
    $strBody .= "============================<br>";
    $strBody .= "P.S. This email was sent from an unmanaged email account.  Please do not reply, as any replies to this message will bounce back.";
    $objMessage->HtmlBody = $strBody;
    // Add random/custom email headers
    $objMessage->SetHeader('x-application', 'Recurring Online Donation');
    QEmailServer::Send($objMessage);
}
Example #13
0
 public function SendMessage()
 {
     // Set debug mode
     //QEmailServer::$TestMode = true;
     //QEmailServer::$TestModeDirectory = __DOCROOT__ . '/../file_assets/emails';
     QEmailServer::$SmtpServer = SMTP_SERVER;
     // Create a new message
     // Note that you can list multiple addresses and that Qcodo supports Bcc and Cc
     $objMessage = new QEmailMessage();
     $objMessage->From = 'info@alcf.net <*****@*****.**>';
     $objMessage->To = 'geraldine.hill@alcf.net  <*****@*****.** >';
     // send to prayer team
     $objMessage->Subject = 'A Confidential Prayer Request was submitted.';
     // Setup Plaintext Message
     $strBody = "Dear Prayer Team,\r\n\r\n";
     $strBody .= sprintf("The following confidential prayer request was submitted:\r\n");
     $strBody .= sprintf($this->txtContent->Text . '\\r\\n');
     $strBody .= '\\r\\nRegards, \\r\\nALCF Communications';
     $objMessage->Body = $strBody;
     // Also setup HTML message (optional)
     $strBody = "Dear Prayer Team,<br/><br/>";
     $strBody .= sprintf("The following confidential prayer request was submitted:<br>");
     $strBody .= sprintf($this->txtContent->Text . "<br>");
     $strBody .= '<br>Regards,<br/><b>ALCF Communications</b>';
     $objMessage->HtmlBody = $strBody;
     // Add random/custom email headers
     $objMessage->SetHeader('x-application', 'Communications Team');
     QEmailServer::Send($objMessage);
 }
Example #14
0
File: index.php Project: alcf/chms
 public function SendMessage($strSubscribedList)
 {
     // Set debug mode
     //QEmailServer::$TestMode = true;
     //QEmailServer::$TestModeDirectory = __DOCROOT__ . '/../file_assets/emails';
     QEmailServer::$SmtpServer = SMTP_SERVER;
     // Create a new message
     // Note that you can list multiple addresses and that Qcodo supports Bcc and Cc
     $objMessage = new QEmailMessage();
     $objMessage->From = 'info@alcf.net <*****@*****.**>';
     $objMessage->To = $this->txtEmail->Text;
     $objMessage->Subject = 'Subscription Confirmation';
     // Setup Plaintext Message
     $strBody = "Dear " . $this->txtFirstName->Text . ",\r\n\r\n";
     $strBody .= sprintf("You have been successfully subscribed to the %s email list.", $strSubscribedList);
     $strBody .= sprintf("\r\nIf you did not subscribe to the list, please contact info@alcf.net");
     $strBody .= '\\r\\nRegards, \\r\\nALCF Communications';
     $objMessage->Body = $strBody;
     // Also setup HTML message (optional)
     $strBody = "Dear " . $this->txtFirstName->Text . ',<br/><br/>';
     $strBody .= sprintf("You have been successfully subscribed to the %s email list.", $strSubscribedList);
     $strBody .= sprintf("<br>If you did not subscribe to the list, please contact info@alcf.net");
     $strBody .= '<br>Regards,<br/><b>ALCF Communications</b>';
     $objMessage->HtmlBody = $strBody;
     // Add random/custom email headers
     $objMessage->SetHeader('x-application', 'Communications Team');
     QEmailServer::Send($objMessage);
 }
Example #15
0
 public function SendMessage()
 {
     // Set debug mode
     //QEmailServer::$TestMode = true;
     //QEmailServer::$TestModeDirectory = __DOCROOT__ . '/../file_assets/emails';
     QEmailServer::$SmtpServer = SMTP_SERVER;
     // Create a new message
     // Note that you can list multiple addresses and that Qcodo supports Bcc and Cc
     $objMessage = new QEmailMessage();
     $objMessage->From = 'info@alcf.net <*****@*****.**>';
     $objMessage->To = $this->txtEmail->Text;
     $objMessage->Subject = 'Your Prayer Request has been successfuly submitted.';
     // Setup Plaintext Message
     $strBody = "Dear " . $this->txtName->Text . ",\r\n\r\n";
     $strBody .= sprintf("You have successfully submitted your prayer request.");
     $strBody .= sprintf("\r\nYou can view your prayer request by selecting the 'View Non-confidential prayer requests' button in the prayer room.");
     $strBody .= sprintf("\r\nIf you selected to view whenever anyone prays for you, you should be able to see the number of people who have prayed for you by observing the indicator when viewing your prayer details.");
     $strBody .= '\\r\\nRegards, \\r\\nALCF Communications';
     $objMessage->Body = $strBody;
     // Also setup HTML message (optional)
     $strBody = "Dear " . $this->txtName->Text . ',<br/><br/>';
     $strBody .= sprintf("You have successfully submitted your prayer request.");
     $strBody .= sprintf("<br>You can view your prayer request by selecting the 'View Non-confidential prayer requests' button in the prayer room.");
     $strBody .= sprintf("<br>If you selected to view whenever anyone prays for you, you should be able to see the number of people who have prayed for you by observing the indicator when viewing your prayer details.");
     $strBody .= '<br>Regards,<br/><b>ALCF Communications</b>';
     $objMessage->HtmlBody = $strBody;
     // Add random/custom email headers
     $objMessage->SetHeader('x-application', 'Communications Team');
     QEmailServer::Send($objMessage);
 }