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


PHP Email::validate方法代码示例

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


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

示例1: testShouldUseEmailValidatorWhenDefined

 public function testShouldUseEmailValidatorWhenDefined()
 {
     $this->resetClassExists();
     $input = 'example@example.com';
     $emailValidator = $this->getEmailValidatorMock();
     $emailValidator->expects($this->once())->method('isValid')->with($input)->will($this->returnValue(true));
     $rule = new Email($emailValidator);
     $this->assertTrue($rule->validate($input));
 }
开发者ID:nowsolutions,项目名称:Validation,代码行数:9,代码来源:EmailTest.php

示例2: validate

 /**
  *
  * @link http://www.linuxjournal.com/article/9585?page=0,3
  * @param string $value
  * @return boolean
  */
 public function validate($value)
 {
     if (!parent::validate($value)) {
         return false;
     }
     $host = substr(strstr($check[0], '@'), 1) . ".";
     if (function_exists('getmxrr')) {
         $tmp = null;
         if (getmxrr($host, $tmp)) {
             return true;
         }
         // this will catch dns that are not mx.
         if (checkdnsrr($host, 'ANY')) {
             return true;
         }
     }
     return $host != gethostbyname($host);
 }
开发者ID:FormHandler,项目名称:FormHandler,代码行数:24,代码来源:EmailHost.php

示例3: send

 /**
  * @abstract A wrapper to the mail function.  All parameters are the same accept for $headers.  The $to address will be validated
  * via Email::validate.
  *
  * @param mixed $to An email address which to send this email to.  Can either be a string address or an EmailAddress object.
  * @param string $subject The subject of the email.
  * @param string $message The message of the email.
  * @param mixed $headers Optional. If a string, then it is passed directly to mail() as it is; otherwise, it is passed to Email::headers()
  * (default: false).
  * @return bool True if the mail was sent successfully; otherwise, false.
  * 
  * @see EmailAddress()
  * @see Email::validate()
  * @see Email::headers()
  */
 public static function send($to, $subject, $body, $replyTo = false)
 {
     if (!Email::validate($to)) {
         return false;
     }
     $mail = self::newMailer();
     $mail->AddAddress($to);
     $mail->From = MAIL_SENDER_NOREPLY;
     $mail->FromName = MAIL_SENDER_NOREPLY_NAME;
     $mail->Subject = $subject;
     $mail->Body = $body;
     if ($replyTo) {
         if (!is_array($replyTo)) {
             $replyTo = array($replyTo, '');
         }
         $mail->AddReplyTo($replyTo[0], $replyTo[1]);
         $mail->From = $replyTo[0];
         $mail->FromName = $replyTo[1];
     }
     return $mail->Send();
 }
开发者ID:BGCX262,项目名称:zwf-svn-to-git,代码行数:36,代码来源:email.php

示例4: test_invalid_emails_should_fail_validation

 /**
  * @dataProvider providerForInvalidEmail
  * @expectedException Respect\Validation\Exceptions\EmailException
  */
 public function test_invalid_emails_should_fail_validation($invalidEmail)
 {
     $validator = new Email();
     $this->assertFalse($validator->validate($invalidEmail));
     $this->assertFalse($validator->assert($invalidEmail));
 }
开发者ID:vituhugo,项目名称:webservice,代码行数:10,代码来源:EmailTest.php

示例5: create

 public static function create($params)
 {
     $user = new User();
     $user->username = $params['user'];
     $user->credential = hasher($params['password']);
     $user->email = $params['email'];
     $user->date_joined = date("Y-m-d H:i:s");
     $user->ip = $_SERVER['REMOTE_ADDR'];
     $user->validation = md5(time() . rand());
     $user->validated = 0;
     $user->member_id = $params['member_id'];
     $user->date_joined = date('Y-m-d H:i:s');
     $user->role = 0;
     $user->last_logged = 0;
     $user->last_seen = 0;
     $user->developer = 0;
     $user->save();
     Email::validate($user);
 }
开发者ID:Oogieboogie23,项目名称:Division-Tracker,代码行数:19,代码来源:User.php

示例6: testFilter

 /**
  * @dataProvider provideTestFilter
  */
 public function testFilter($options, $raw, $filtered, $valid)
 {
     $int = new Email($options);
     $this->assertEquals($filtered, $int->filter($raw));
     $this->assertEquals($valid, $int->validate($raw));
 }
开发者ID:puwenhan,项目名称:filterus,代码行数:9,代码来源:EmailTest.php

示例7: testValidateValidEmail

 public function testValidateValidEmail()
 {
     $email = new Email('as@asd.com', 'as', 'asde');
     $this->assertTrue($email->validate());
 }
开发者ID:mgparada,项目名称:inbentachallenge,代码行数:5,代码来源:EmailTest.php

示例8: testIsGettingErrorMessage

 public function testIsGettingErrorMessage()
 {
     $constraint = new Email();
     $this->assertFalse($constraint->validate('foobar.com'));
     $this->assertEquals('[field] Invalid email format', $constraint->getErrorMessage('field'));
 }
开发者ID:reisraff,项目名称:input,代码行数:6,代码来源:EmailTest.php


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