Commits

Carlos Belisario committed d5cb55e Merge

Merge pull request #1 from carlosbelisario/master

Agregado el método sendmail a la interface

  • Participants
  • Parent commits ef878c6, 35ef141

Comments (0)

Files changed (5)

File CrugeMailer.php

 		}
 		
 		public function enviarClave(Usuario $usuario){
-			$this->sendemail($usuario->email,self::t("recuperacion de clave")
+			$this->sendEmail($usuario->email, self::t("recuperacion de clave")
 				,$this->render('enviarclave',array('data'=>$usuario))
 			);
 		}
+        
+        public function sendEmail($to,$subject,$body) 
+        {
+            if(!parent::sendEmail($to,$subject,$body)) {
+                throw new CrugeMailerException('El Mail no ha sido enviado revise la configuración del servidor');
+            }
+            return true;
+        }
 	}
-?>
+?>

File CrugeMailerBase.php

 	protected function render($viewname,$data=array()){
 		return $this->getController()->render($viewname,$data,true);
 	}
-	protected function sendemail($to,$subject,$body) {
+	protected function sendEmail($to,$subject,$body) {
 		$from = $this->mailfrom;
 		$headers="From: {$from}\r\nReply-To: {$from}";
 		$ret = @mail($to,$this->subjectprefix.$subject,$body,$headers);

File CrugeMailerException.php

+<?php 
+class CrugeMailerException extends Exception
+{
+
+}

File ICrugeMailer.php

 */
 interface ICrugeMailer {
 	public function t($text);
-}
+
+    /**
+    *
+    * @method sendmailer
+    * @param String $to correo destinatario
+    * @param String $subject asunto del correo
+    * @param String $body cuerpo del correo 
+    * @return boolean
+    * @throws CrugeMailerException
+    */
+    public function sendeMail($to,$subject,$body);
+}

File README.md

File contents unchanged.