当前位置: 首页>>代码示例>>PHP>>正文


PHP CRM_Utils_Mail::formatRFC822Email方法代码示例

本文整理汇总了PHP中CRM_Utils_Mail::formatRFC822Email方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Utils_Mail::formatRFC822Email方法的具体用法?PHP CRM_Utils_Mail::formatRFC822Email怎么用?PHP CRM_Utils_Mail::formatRFC822Email使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CRM_Utils_Mail的用法示例。


在下文中一共展示了CRM_Utils_Mail::formatRFC822Email方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testFormatRFC822

 /**
  * test case for add( )
  * test with empty params.
  */
 function testFormatRFC822()
 {
     $values = array(array('name' => "Test User", 'email' => "foo@bar.com", 'result' => "Test User <foo@bar.com>"), array('name' => '"Test User"', 'email' => "foo@bar.com", 'result' => "Test User <foo@bar.com>"), array('name' => "User, Test", 'email' => "foo@bar.com", 'result' => '"User, Test" <foo@bar.com>'), array('name' => '"User, Test"', 'email' => "foo@bar.com", 'result' => '"User, Test" <foo@bar.com>'), array('name' => '"Test User"', 'email' => "foo@bar.com", 'result' => '"Test User" <foo@bar.com>', 'useQuote' => TRUE), array('name' => "User, Test", 'email' => "foo@bar.com", 'result' => '"User, Test" <foo@bar.com>', 'useQuote' => TRUE));
     foreach ($values as $value) {
         $result = CRM_Utils_Mail::formatRFC822Email($value['name'], $value['email'], CRM_Utils_Array::value('useQuote', $value, FALSE));
         $this->assertEquals($result, $value['result'], 'Expected encoding does not match');
     }
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:12,代码来源:MailTest.php

示例2: testSend

 /**
  * Basic send.
  */
 public function testSend()
 {
     $contact_params_1 = array('first_name' => substr(sha1(rand()), 0, 7), 'last_name' => 'Anderson', 'email' => substr(sha1(rand()), 0, 7) . '@example.org', 'contact_type' => 'Individual');
     $contact_id_1 = $this->individualCreate($contact_params_1);
     $contact_params_2 = array('first_name' => substr(sha1(rand()), 0, 7), 'last_name' => 'Xylophone', 'email' => substr(sha1(rand()), 0, 7) . '@example.org', 'contact_type' => 'Individual');
     $contact_id_2 = $this->individualCreate($contact_params_2);
     $subject = 'Test spool';
     $params = array('from' => CRM_Utils_Mail::formatRFC822Email($contact_params_1['first_name'] . " " . $contact_params_1['last_name'], $contact_params_1['email']), 'toName' => $contact_params_2['first_name'] . " " . $contact_params_2['last_name'], 'toEmail' => $contact_params_2['email'], 'subject' => $subject, 'text' => self::$bodytext, 'html' => "<p>\n" . self::$bodytext . '</p>');
     CRM_Utils_Mail::send($params);
     $mail = $this->_mut->getMostRecentEmail('raw');
     $this->assertContains("Subject: {$subject}", $mail);
     $this->assertContains(self::$bodytext, $mail);
     $mail = $this->_mut->getMostRecentEmail('ezc');
     $this->assertEquals($subject, $mail->subject);
     $this->assertContains($contact_params_1['email'], $mail->from->email, 'From address incorrect.');
     $this->assertContains($contact_params_2['email'], $mail->to[0]->email, 'Recipient incorrect.');
     $context = new ezcMailPartWalkContext(array(get_class($this), 'mailWalkCallback'));
     $mail->walkParts($context, $mail);
 }
开发者ID:konadave,项目名称:civicrm-core,代码行数:22,代码来源:SpoolTest.php


注:本文中的CRM_Utils_Mail::formatRFC822Email方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。