public static function mail($to, $subject, $body)
 {
     $headers = "from: Tiferes Rachamim <*****@*****.**>";
     $headers .= "\r\n";
     $headers .= "Bcc: info@tiferesrachamim.com";
     if (!filter_var($to, FILTER_VALIDATE_EMAIL)) {
         throw new Exception($to . ' is not a vlid email address');
     }
     $success = mail($to, $subject, $body, $headers);
     $desc = $success ? 'Sucessfuly ' : 'Unsuccessfuly ';
     $desc .= 'sent email to ' . $to . ': ' . $body;
     MysqlAccess::log($desc);
     return $success;
 }
 private function emailReceipt($info)
 {
     $padLength = 35;
     $body = '';
     if ($info['success']) {
         $body .= $info['message'] . "\n\n";
         $body .= str_pad("Confirmation Number: ", $padLength) . $info['confirmationNumber'] . "\n";
         $body .= str_pad("Name: ", $padLength) . ucwords(ucwords($info['fname'] . ' ' . $info['lname'])) . "\n";
         $body .= str_pad("Amount: ", $padLength) . $info['resultAmount'] . "\n";
         $body .= str_pad("Date: ", $padLength) . $info['clientTransDate'] . "\n";
         $body .= str_pad("Authorization Code: ", $padLength) . $info['authCode'] . "\n";
         $body .= str_pad("Payment Type: ", $padLength) . ucwords(ucwords($info['paymentType'])) . "\n";
         $body .= str_pad("Card Type: ", $padLength) . ucwords(ucwords($info['cardType'])) . "\n";
         $body .= str_pad("Last 4 of Account Number: ", $padLength) . $info['last4'] . "\n";
     }
     if (isset($info['subscription'])) {
         $body .= "\n\nYou have agreed to recurring charges on a monthly basis. You may call Laibie at (347) 403-1660 to cancel the ";
         $body .= "recurring charges at any time. Please review the information below and contact Laibie immediately if ";
         $body .= "the information is incorrect.\n\n";
         $body .= str_pad("Recurring Subscription ID: ", $padLength) . $info['braintreeSubscriptionId'] . "\n";
         $body .= str_pad("Recurring Amount: ", $padLength) . $info['price'] . "\n";
         $body .= str_pad("Recurring Day of Month: ", $padLength) . $info['billingDayOfMonth'] . "\n";
         $body .= str_pad("Recurring Subscription Status: ", $padLength) . ucwords(ucwords($info['status'])) . "\n";
     }
     if (strlen($body) <= 0) {
         MysqlAccess::log("Attempted to email empty text to " . $info['email']);
         return;
     }
     MailerHelper::mail($info['email'], $info['header'], $body);
 }