src/Actions/EmailAction.php
public function perform()
    {
        $params = array_merge($this->options, [
            'to' => $this->requireOption('to'),
            'from' => $this->requireOption('from'),
            'replyTo' => $this->option('replyTo', $this->form->data(self::EMAIL_KEY)),
            'subject' => $this->getSubject(),
        ]);

        if (empty($params['replyTo'])) {
            unset($params['replyTo']);
        }

        if (array_key_exists('data', $params)) {
            $params['data'] = array_merge($params['data'], $this->form->data());
        } else {
            $params['data'] = $this->form->data();
        }

        if (isset($params['template'])) {
            $params['data'] = array_merge($params['data'], [
                '_data' => $params['data'],
                '_options' => $this->options,
            ]);
        } else {
            $params['body'] = $this->getBody();
        }

        try {
            $this->sendEmail($params);

            if ($this->shouldReceiveCopy()) {
                $params['subject'] = I18n::translate('uniform-email-copy').' '.$params['subject'];
                $to = $params['to'];
                $params['to'] = $params['replyTo'];
                $params['replyTo'] = $to;
                $this->sendEmail($params);
            }
        } catch (Exception $e) {
            $this->handleException($e);
        }
    }
public function perform()
    {
        $params = array_merge($this->options, [
            'to' => $this->requireOption('to'),
            'from' => $this->requireOption('from'),
            'replyTo' => $this->option('replyTo', $this->form->data(self::EMAIL_KEY)),
            'subject' => $this->getSubject(),
        ]);

        if (empty($params['replyTo'])) {
            unset($params['replyTo']);
        }

        if (array_key_exists('data', $params)) {
            $params['data'] = array_merge($params['data'], $this->form->data());
        } else {
            $params['data'] = $this->form->data();
        }

        if (isset($params['template'])) {
            $params['data'] = array_merge($params['data'], [
                '_data' => $params['data'],
                '_options' => $this->options,
            ]);
        } else {
            $params['body'] = $this->getBody();
        }

        try {
            $this->sendEmail($params);

            if ($this->shouldReceiveCopy()) {
                $params['subject'] = I18n::translate('uniform-email-copy').' '.$params['subject'];
                $to = $params['to'];
                $params['to'] = $params['replyTo'];
                $params['replyTo'] = $to;
                $this->sendEmail($params);
            }
        } catch (Exception $e) {
            $this->handleException($e);
        }
    }
public function perform ( ) { $ params = array_merge ( $ this -> options , [ 'to' => $ this -> requireOption ( 'to' ) , 'from' => $ this -> requireOption ( 'from' ) , 'replyTo' => $ this -> option ( 'replyTo' , $ this -> form -> data ( self :: EMAIL_KEY ) ) , 'subject' => $ this -> getSubject ( ) , ] ) ; if ( empty ( $ params [ 'replyTo' ] ) ) { unset ( $ params [ 'replyTo' ] ) ; } if ( array_key_exists ( 'data' , $ params ) ) { $ params [ 'data' ] = array_merge ( $ params [ 'data' ] , $ this -> form -> data ( ) ) ; } else { $ params [ 'data' ] = $ this -> form -> data ( ) ; } if ( isset ( $ params [ 'template' ] ) ) { $ params [ 'data' ] = array_merge ( $ params [ 'data' ] , [ '_data' => $ params [ 'data' ] , '_options' => $ this -> options , ] ) ; } else { $ params [ 'body' ] = $ this -> getBody ( ) ; } try { $ this -> sendEmail ( $ params ) ; if ( $ this -> shouldReceiveCopy ( ) ) { $ params [ 'subject' ] = I18n :: translate ( 'uniform-email-copy' ) . ' ' . $ params [ 'subject' ] ; $ to = $ params [ 'to' ] ; $ params [ 'to' ] = $ params [ 'replyTo' ] ; $ params [ 'replyTo' ] = $ to ; $ this -> sendEmail ( $ params ) ; } } catch ( Exception $ e ) { $ this -> handleException ( $ e ) ; } }
Send the form data via email.
Send the form data via email .