* mime_type: mime type of the attachment
* cleanName: the user friendly name of the attachmment
*
- * @param array $params (by reference)
- *
- * @access public
+ * @param array $params
+ * (by reference).
*
- * @return boolean true if a mail was sent, else false
+ * @return boolean
+ * true if a mail was sent, else false
*/
public static function send(&$params) {
- $returnPath = CRM_Core_BAO_MailSettings::defaultReturnPath();
+ $returnPath = CRM_Core_BAO_MailSettings::defaultReturnPath();
$includeMessageId = CRM_Core_BAO_MailSettings::includeMessageId();
- $emailDomain = CRM_Core_BAO_MailSettings::defaultDomain();
- $from = CRM_Utils_Array::value('from', $params);
+ $emailDomain = CRM_Core_BAO_MailSettings::defaultDomain();
+ $from = CRM_Utils_Array::value('from', $params);
if (!$returnPath) {
$returnPath = self::pluckEmailFromHeader($from);
}
$htmlMessage = FALSE;
}
- $headers = array();
+ $headers = array();
// CRM-10699 support custom email headers
if (!empty($params['headers'])) {
$headers = array_merge($headers, $params['headers']);
}
$headers['From'] = $params['from'];
- $headers['To'] =
+ $headers['To'] =
self::formatRFC822Email(
CRM_Utils_Array::value('toName', $params),
CRM_Utils_Array::value('toEmail', $params),
$headers = &$msg->headers($headers);
$to = array($params['toEmail']);
- $result = null;
- $mailer =& CRM_Core_Config::getMailer( );
+ $result = NULL;
+ $mailer =& CRM_Core_Config::getMailer();
// Mail_smtp and Mail_sendmail mailers require Bcc anc Cc emails
// be included in both $to and $headers['Cc', 'Bcc']
if (get_class($mailer) != "Mail_mail") {
- //get emails from headers, since these are
- //combination of name and email addresses.
- if (!empty($headers['Cc'])) {
- $to[] = CRM_Utils_Array::value( 'Cc', $headers );
- }
- if (!empty($headers['Bcc'])) {
- $to[] = CRM_Utils_Array::value( 'Bcc', $headers );
- }
+ //get emails from headers, since these are
+ //combination of name and email addresses.
+ if (!empty($headers['Cc'])) {
+ $to[] = CRM_Utils_Array::value('Cc', $headers);
+ }
+ if (!empty($headers['Bcc'])) {
+ $to[] = CRM_Utils_Array::value('Bcc', $headers);
+ }
}
if (is_object($mailer)) {
$errorScope = CRM_Core_TemporaryErrorScope::ignoreException();
*/
public static function errorMessage($mailer, $result) {
$message = '<p>' . ts('An error occurred when CiviCRM attempted to send an email (via %1). If you received this error after submitting on online contribution or event registration - the transaction was completed, but we were unable to send the email receipt.', array(
- 1 => 'SMTP')) . '</p>' . '<p>' . ts('The mail library returned the following error message:') . '<br /><span class="font-red"><strong>' . $result->getMessage() . '</strong></span></p>' . '<p>' . ts('This is probably related to a problem in your Outbound Email Settings (Administer CiviCRM » System Settings » Outbound Email), OR the FROM email address specifically configured for your contribution page or event. Possible causes are:') . '</p>';
+ 1 => 'SMTP'
+ )) . '</p>' . '<p>' . ts('The mail library returned the following error message:') . '<br /><span class="font-red"><strong>' . $result->getMessage() . '</strong></span></p>' . '<p>' . ts('This is probably related to a problem in your Outbound Email Settings (Administer CiviCRM » System Settings » Outbound Email), OR the FROM email address specifically configured for your contribution page or event. Possible causes are:') . '</p>';
if (is_a($mailer, 'Mail_smtp')) {
$message .= '<ul>' . '<li>' . ts('Your SMTP Username or Password are incorrect.') . '</li>' . '<li>' . ts('Your SMTP Server (machine) name is incorrect.') . '</li>' . '<li>' . ts('You need to use a Port other than the default port 25 in your environment.') . '</li>' . '<li>' . ts('Your SMTP server is just not responding right now (it is down for some reason).') . '</li>';
}
$message .= '<li>' . ts('The FROM Email Address configured for this feature may not be a valid sender based on your email service provider rules.') . '</li>' . '</ul>' . '<p>' . ts('Check <a href="%1">this page</a> for more information.', array(
- 1 => CRM_Utils_System::docURL2('user/advanced-configuration/email-system-configuration', TRUE))) . '</p>';
+ 1 => CRM_Utils_System::docURL2('user/advanced-configuration/email-system-configuration', TRUE)
+ )) . '</p>';
return $message;
}
*
* Ugly but working.
*
- * @param string $header the full name + email address string
+ * @param string $header
+ * The full name + email address string.
*
- * @return string the plucked email address
- * @static
+ * @return string
+ * the plucked email address
*/
public static function pluckEmailFromHeader($header) {
preg_match('/<([^<]*)>$/', $header, $matches);
/**
* Get the Active outBound email
*
- * @return boolean true if valid outBound email configuration found, false otherwise
- * @access public
- * @static
+ * @return boolean
+ * true if valid outBound email configuration found, false otherwise
*/
public static function validOutBoundMail() {
$mailingInfo = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME,
* @param string $html
* @param string $format
*
- * @return array $attachments
+ * @return array
*/
public static function appendPDF($fileName, $html, $format = NULL) {
$pdf_filename = CRM_Core_Config::singleton()->templateCompileDir . CRM_Utils_File::makeFileName($fileName);
$html = preg_replace('/(<html)(.+?xmlns=["\'].[^\s]+["\'])(.+)?(>)/', '\1\3\4', $html);
file_put_contents($pdf_filename, CRM_Utils_PDF_Utils::html2pdf($html,
- $fileName,
- TRUE,
- $format)
+ $fileName,
+ TRUE,
+ $format)
);
return array(
'fullPath' => $pdf_filename,
);
}
}
-