src/Mail/Mail.php
public function send($closure = null) {

		if(gettype($closure) == 'object') {
			call_user_func($closure, $this);
		}

		//Renders the optional viewmodels and assign the mail variables to them
		foreach($this -> viewmodels as $type => $view) {

			if(null !== $view) {

				$viewmodel = new ViewModel($view, false);
				$viewmodel -> assign($this -> variables);

				$this -> message[$type] = $viewmodel -> render();
			}
		}

		$to 	 = $this -> formatTo();
		$headers = $this -> formatHeaders();
		$message = $this -> formatMessage();

		@mail($to, $this -> subject, $message, $headers);

		if(null === error_get_last()) {
			$this -> send = true;			
		}

		return $this;
	}
public function send($closure = null) {

		if(gettype($closure) == 'object') {
			call_user_func($closure, $this);
		}

		//Renders the optional viewmodels and assign the mail variables to them
		foreach($this -> viewmodels as $type => $view) {

			if(null !== $view) {

				$viewmodel = new ViewModel($view, false);
				$viewmodel -> assign($this -> variables);

				$this -> message[$type] = $viewmodel -> render();
			}
		}

		$to 	 = $this -> formatTo();
		$headers = $this -> formatHeaders();
		$message = $this -> formatMessage();

		@mail($to, $this -> subject, $message, $headers);

		if(null === error_get_last()) {
			$this -> send = true;			
		}

		return $this;
	}
public function send ( $ closure = null ) { if ( gettype ( $ closure ) == 'object' ) { call_user_func ( $ closure , $ this ) ; } //Renders the optional viewmodels and assign the mail variables to them
 foreach ( $ this -> viewmodels as $ type => $ view ) { if ( null !== $ view ) { $ viewmodel = new ViewModel ( $ view , false ) ; $ viewmodel -> assign ( $ this -> variables ) ; $ this -> message [ $ type ] = $ viewmodel -> render ( ) ; } } $ to = $ this -> formatTo ( ) ; $ headers = $ this -> formatHeaders ( ) ; $ message = $ this -> formatMessage ( ) ; @ mail ( $ to , $ this -> subject , $ message , $ headers ) ; if ( null === error_get_last ( ) ) { $ this -> send = true ; } return $ this ; }
Try to send the mail with optional callback.
@param object $closure
@return sFire\Mail\Mail
Try to send the mail with optional callback .