src/MimeMailer/Mailer.php
public function send($return_info = false)
    {
        $this->_presendInit();

        $msg = $this->getMessage()
            ->buildMessage()
            ->getMessage();

        // Then we send one by one
        if (false===$this->dry_run) {
            foreach ($this->getMessage()->get('to') as $set) {
                if (!empty($set) && is_array($set)) {
                    foreach ($set as $name=>$mail) {
                        if (is_numeric($name)) {
                            $name = $mail;
                        }
                        if (true===$this->spool) {
                            if (true===$this->spoolMessage($mail, $this->getMessage()->get('subject'), '', $msg)) {
                                $this->addInfo(
                                    sprintf('Spooling message to send to "%s".', $mail)
                                );
                            } else {
                                $this->addError(
                                    sprintf('!! - Error while spooling message to send to "%s"!', $mail)
                                );
                            }
                        } else {
                            if (false===$this->sendMessage($mail, $this->getMessage()->get('subject'), '', $msg)) {
                                $this->addError(
                                    sprintf('!! - The message can not be sent to "%s"!', $mail)
                                );
                                $this->sent_errors++;
                            } else {
                                $this->addInfo(
                                    sprintf('Message sent to "%s".', $mail)
                                );
                                $this->sent_messages++;
                            }
                        }
                    }
                }
            }
        } else {
            $this->addInfo('DryRun : no mail will be sent');
        }

        // errors ? infos ?
        if ($this->sent_errors>0) {
            $msg = "Error - The message(s) can not been sent ... Check errors pile!";
            $this->addInfo($msg);
            $this->addError($msg);
        } else {
            $msg = "OK - The message(s) have been sent ...";
            $this->addInfo($msg);
        }

        // return
        if (true===$return_info) {
            return $msg;
        }
        return $this->sent_messages>0;
    }
public function send($return_info = false)
    {
        $this->_presendInit();

        $msg = $this->getMessage()
            ->buildMessage()
            ->getMessage();

        // Then we send one by one
        if (false===$this->dry_run) {
            foreach ($this->getMessage()->get('to') as $set) {
                if (!empty($set) && is_array($set)) {
                    foreach ($set as $name=>$mail) {
                        if (is_numeric($name)) {
                            $name = $mail;
                        }
                        if (true===$this->spool) {
                            if (true===$this->spoolMessage($mail, $this->getMessage()->get('subject'), '', $msg)) {
                                $this->addInfo(
                                    sprintf('Spooling message to send to "%s".', $mail)
                                );
                            } else {
                                $this->addError(
                                    sprintf('!! - Error while spooling message to send to "%s"!', $mail)
                                );
                            }
                        } else {
                            if (false===$this->sendMessage($mail, $this->getMessage()->get('subject'), '', $msg)) {
                                $this->addError(
                                    sprintf('!! - The message can not be sent to "%s"!', $mail)
                                );
                                $this->sent_errors++;
                            } else {
                                $this->addInfo(
                                    sprintf('Message sent to "%s".', $mail)
                                );
                                $this->sent_messages++;
                            }
                        }
                    }
                }
            }
        } else {
            $this->addInfo('DryRun : no mail will be sent');
        }

        // errors ? infos ?
        if ($this->sent_errors>0) {
            $msg = "Error - The message(s) can not been sent ... Check errors pile!";
            $this->addInfo($msg);
            $this->addError($msg);
        } else {
            $msg = "OK - The message(s) have been sent ...";
            $this->addInfo($msg);
        }

        // return
        if (true===$return_info) {
            return $msg;
        }
        return $this->sent_messages>0;
    }
public function send ( $ return_info = false ) { $ this -> _presendInit ( ) ; $ msg = $ this -> getMessage ( ) -> buildMessage ( ) -> getMessage ( ) ; // Then we send one by one if ( false === $ this -> dry_run ) { foreach ( $ this -> getMessage ( ) -> get ( 'to' ) as $ set ) { if ( ! empty ( $ set ) && is_array ( $ set ) ) { foreach ( $ set as $ name => $ mail ) { if ( is_numeric ( $ name ) ) { $ name = $ mail ; } if ( true === $ this -> spool ) { if ( true === $ this -> spoolMessage ( $ mail , $ this -> getMessage ( ) -> get ( 'subject' ) , '' , $ msg ) ) { $ this -> addInfo ( sprintf ( 'Spooling message to send to "%s".' , $ mail ) ) ; } else { $ this -> addError ( sprintf ( '!! - Error while spooling message to send to "%s"!' , $ mail ) ) ; } } else { if ( false === $ this -> sendMessage ( $ mail , $ this -> getMessage ( ) -> get ( 'subject' ) , '' , $ msg ) ) { $ this -> addError ( sprintf ( '!! - The message can not be sent to "%s"!' , $ mail ) ) ; $ this -> sent_errors ++ ; } else { $ this -> addInfo ( sprintf ( 'Message sent to "%s".' , $ mail ) ) ; $ this -> sent_messages ++ ; } } } } } } else { $ this -> addInfo ( 'DryRun : no mail will be sent' ) ; } // errors ? infos ? if ( $ this -> sent_errors > 0 ) { $ msg = "Error - The message(s) can not been sent ... Check errors pile!" ; $ this -> addInfo ( $ msg ) ; $ this -> addError ( $ msg ) ; } else { $ msg = "OK - The message(s) have been sent ..." ; $ this -> addInfo ( $ msg ) ; } // return if ( true === $ return_info ) { return $ msg ; } return $ this -> sent_messages > 0 ; }
Messages sender

@param bool $return_info Do we have to return an information about sending ?
@return bool|mixed
Messages sender