**********************************************
 Email methods
 Use send_form_email to send the contents of any form to the support email address
424200
def send_form_email(params, subject)
        body = []
        params.each_pair { |k,v| body << "#{k}: #{v}"  }
        BasicMailer.mail(:subject => subject, :body => body.join("\n")).deliver
      end
1011298
public static function sendHtmlEmail (\stdClass $emailBody, \stdClass $to, \stdClass $from, \stdClass $replyTo, $SMTPConfig='') : bool
	{
		$mail = new PHPMailer;
		static::setSMTPConfig($mail, $SMTPConfig);
	    $mail->Subject 	= $emailBody->subject;
	    $mail->MsgHTML($emailBody->messageBody);
	    $mail->addAddress($to->email, $to->name);
	    $mail->setFrom($from->email, $from->name);
		$mail->addReplyTo($replyTo->email, $replyTo->name);
		static::$result 		= $mail->send();
		static::$errorMessage 	= $mail->ErrorInfo;
	    return static::$result ? TRUE : FALSE;
	}
938601
def send_confirmation_email(self):
        
        form = self._get_form('SECURITY_SEND_CONFIRMATION_FORM')
        if form.validate_on_submit():
            self.security_service.send_email_confirmation_instructions(form.user)
            self.flash(_('flask_unchained.bundles.security:flash.confirmation_request',
                         email=form.user.email), category='info')
            if request.is_json:
                return '', HTTPStatus.NO_CONTENT

        elif form.errors and request.is_json:
            return self.errors(form.errors)

        return self.render('send_confirmation_email',
                           send_confirmation_form=form,
                           **self.security.run_ctx_processor('send_confirmation_email'))
765775
function process_form($form, &$preferences){
        global $CFG;

        if (isset($form->email_email)) {
            $preferences['message_processor_email_email'] = clean_param($form->email_email, PARAM_EMAIL);
        }
        if (isset($form->preference_mailcharset)) {
            $preferences['mailcharset'] = $form->preference_mailcharset;
            if (!array_key_exists($preferences['mailcharset'], get_list_of_charsets())) {
                $preferences['mailcharset'] = '0';
            }
        }
        if (isset($form->mailformat) && isset($form->userid)) {
            require_once($CFG->dirroot.'/user/lib.php');

            $user = core_user::get_user($form->userid, '*', MUST_EXIST);
            $user->mailformat = clean_param($form->mailformat, PARAM_INT);
            user_update_user($user, false, false);
        }
    }
234076
public function sendContent()
    {
        $url = htmlspecialchars(strval($this->getContent()));
        $message = $this->statusText ?: self::getStatusText($this->getStatusCode());
        echo <<<PAGE
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
	<head>
		<meta http-equiv="Refresh" content="0; url='{$url}'">
		<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
		<title>{$message}</title>
	</head>
	<body>
		<script>
			function doRedirect()
			{
				location.replace("{$url}");
			}
			setTimeout("doRedirect()", 1000);
		</script>
		<p>Your browser does not support automatic redirection. Please follow <a href="{$url}">this link</a>.</p>
	</body>
</html>
PAGE;
        return $this;
    }
122967
public function send()
    {
        $oConfig = \OxidEsales\Eshop\Core\Registry::getConfig();

        if (!$oConfig->getConfigParam("blInvitationsEnabled")) {
            \OxidEsales\Eshop\Core\Registry::getUtils()->redirect($oConfig->getShopHomeUrl());
        }

        $aParams = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('editval', true);
        $oUser = $this->getUser();
        if (!is_array($aParams) || !$oUser) {
            return;
        }

        // storing used written values
        $oParams = (object) $aParams;
        $this->setInviteData((object) \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('editval'));

        $oUtilsView = \OxidEsales\Eshop\Core\Registry::getUtilsView();

        // filled not all fields ?
        foreach ($this->_aReqFields as $sFieldName) {
            //checking if any email was entered
            if ($sFieldName == "rec_email") {
                foreach ($aParams[$sFieldName] as $sKey => $sEmail) {
                    //removing empty emails fields from eMails array
                    if (empty($sEmail)) {
                        unset($aParams[$sFieldName][$sKey]);
                    }
                }

                //counting entered eMails
                if (count($aParams[$sFieldName]) < 1) {
                    $oUtilsView->addErrorToDisplay('ERROR_MESSAGE_COMPLETE_FIELDS_CORRECTLY');

                    return;
                }

                //updating values object
                $oParams->rec_email = $aParams[$sFieldName];
            }

            if (!isset($aParams[$sFieldName]) || !$aParams[$sFieldName]) {
                $oUtilsView->addErrorToDisplay('ERROR_MESSAGE_COMPLETE_FIELDS_CORRECTLY');

                return;
            }
        }

        //validating entered emails
        foreach ($aParams["rec_email"] as $sRecipientEmail) {
            if (!oxNew(\OxidEsales\Eshop\Core\MailValidator::class)->isValidEmail($sRecipientEmail)) {
                $oUtilsView->addErrorToDisplay('ERROR_MESSAGE_INVITE_INCORRECTEMAILADDRESS');

                return;
            }
        }

        if (!oxNew(\OxidEsales\Eshop\Core\MailValidator::class)->isValidEmail($aParams["send_email"])) {
            $oUtilsView->addErrorToDisplay('ERROR_MESSAGE_INVITE_INCORRECTEMAILADDRESS');

            return;
        }

        // sending invite email
        $oEmail = oxNew(\OxidEsales\Eshop\Core\Email::class);

        if ($oEmail->sendInviteMail($oParams)) {
            $this->_iMailStatus = 1;

            //getting active user
            $oUser = $this->getUser();

            //saving statistics for sent emails
            $oUser->updateInvitationStatistics($aParams["rec_email"]);
        } else {
            \OxidEsales\Eshop\Core\Registry::getUtilsView()->addErrorToDisplay('ERROR_MESSAGE_CHECK_EMAIL');
        }
    }
580358
public function _sendMail()
    {
        $date = gmdate('D, d M Y H:i:s O');

        //Send the request
        $client = new Zend_Http_Client($this->_host);
        $client->setMethod(Zend_Http_Client::POST);
        $client->setHeaders(array(
            'Date' => $date,
            'X-Amzn-Authorization' => $this->_buildAuthKey($date)
        ));
        $client->setEncType('application/x-www-form-urlencoded');

        //Build the parameters
        $params = array(
            'Action' => 'SendRawEmail',
            'Source' => $this->_mail->getFrom(),
            'RawMessage.Data' => base64_encode(sprintf("%s\n%s\n", $this->header, $this->body))
        );

        $recipients = explode(',', $this->recipients);
        while(list($index, $recipient) = each($recipients)){
            $params[sprintf('Destination.ToAddresses.member.%d', $index + 1)] = $recipient;
        }

        $client->resetParameters();
        $client->setParameterPost($params);
        $response = $client->request(Zend_Http_Client::POST);

        if($response->getStatus() != 200){
            throw new Exception($response->getBody());
        }
    }
598397
public function index()
    {
        if (!userHasPermission('admin:email:utilities:sendTest')) {
            unauthorised();
        }

        // --------------------------------------------------------------------------

        //  Page Title
        $this->data['page']->title = 'Send a Test Email';

        // --------------------------------------------------------------------------

        $oInput = Factory::service('Input');
        if ($oInput->post()) {

            //  Form validation and update
            $oFormValidation = Factory::service('FormValidation');

            //  Define rules
            $oFormValidation->set_rules('recipient', '', 'required|valid_email');

            //  Set Messages
            $oFormValidation->set_message('required', lang('fv_required'));
            $oFormValidation->set_message('valid_email', lang('fv_valid_email'));

            //  Execute
            if ($oFormValidation->run()) {

                //  Prepare data
                $oNow   = Factory::factory('DateTime');
                $oEmail = (object) [
                    'type'     => 'test_email',
                    'to_email' => $oInput->post('recipient', true),
                    'data'     => [
                        'sentAt' => $oNow->format('Y-m-d H:i:s'),
                    ],
                ];

                //  Send the email
                $oEmailer = Factory::service('Emailer', 'nails/module-email');
                if ($oEmailer->send($oEmail)) {

                    $this->data['success'] = '<strong>Done!</strong> Test email successfully sent to <strong>';
                    $this->data['success'] .= $oEmail->to_email . '</strong> at ' . toUserDatetime();

                } else {

                    echo '<h1>Sending Failed, debugging data below:</h1>';
                    echo $oEmailer->print_debugger();
                    return;
                }
            }
        }

        // --------------------------------------------------------------------------

        //  Load views
        Helper::loadView('index');
    }
693449
function definition() {
        global $USER;

        $mform    = $this->_form;
        $mform->setDisableShortforms(true);

        $mform->addElement('header', 'searchbyusername', get_string('searchbyusername'), '');

        $purpose = user_edit_map_field_purpose($USER->id, 'username');
        $mform->addElement('text', 'username', get_string('username'), 'size="20"' . $purpose);
        $mform->setType('username', PARAM_RAW);

        $submitlabel = get_string('search');
        $mform->addElement('submit', 'submitbuttonusername', $submitlabel);

        $mform->addElement('header', 'searchbyemail', get_string('searchbyemail'), '');

        $purpose = user_edit_map_field_purpose($USER->id, 'email');
        $mform->addElement('text', 'email', get_string('email'), 'maxlength="100" size="30"' . $purpose);
        $mform->setType('email', PARAM_RAW_TRIMMED);

        $submitlabel = get_string('search');
        $mform->addElement('submit', 'submitbuttonemail', $submitlabel);
    }
213624
function create()
    {
        $content = $this->loadContentTypes();
        $templates = $this->loadTemplates();
        restoreRequest();
        $form = array (
            'name' => 'createPage',
            'caption' => strAdd,
            'width' => '600px',
            'fields' => array (
                array ('type' => 'hidden','name'=>'owner','value'=>arg('owner', 'int')),
                array ('type' => 'hidden','name'=>'action', 'value'=>'insert'),
                array ('type' => 'edit','name' => 'name','label' => admPagesName,'width' => '150px',
                    'maxlength' => '32', 'pattern'=>'/^[a-z0-9_]+$/i', 'errormsg'=>admPagesNameInvalid),
                array ('type' => 'edit','name' => 'title','label' => admPagesTitle,'width' => '100%',
                    'pattern'=>'/.+/', 'errormsg'=>admPagesTitleInvalid),
                array ('type' => 'edit','name' => 'caption','label' => admPagesCaption,'width' => '100%',
                    'maxlength' => '64', 'pattern'=>'/.+/', 'errormsg'=>admPagesCaptionInvalid),
                array ('type' => 'edit','name' => 'hint','label' => admPagesHint,'width' => '100%'),
                array ('type' => 'edit','name' => 'description','label' => admPagesDescription,
                    'width' => '100%'),
                array ('type' => 'edit','name' => 'keywords','label' => admPagesKeywords,'width' => '100%'),
                array ('type' => 'select','name' => 'template','label' => admPagesTemplate,
                    'items' => $templates[0], 'values' => $templates[1], 'default'=>pageTemplateDefault),
                array ('type' => 'select','name' => 'type','label' => admPagesContentType,
                    'items' => $content[0], 'values' => $content[1], 'default'=>contentTypeDefault),
                array ('type' => 'checkbox','name' => 'active','label' => admPagesActive, 'default'=>true),
                array ('type' => 'checkbox','name' => 'visible','label' => admPagesVisible,
                    'default'=>true),
                array ('type' => 'select','name' => 'access','label' => admAccessLevel,'access' => ADMIN,
                    'values'=>array(ADMIN,EDITOR,USER,GUEST),
                    'items' => array (ACCESSLEVEL2,ACCESSLEVEL3,ACCESSLEVEL4,ACCESSLEVEL5),
                    'default' => GUEST),
                array ('type' => 'edit','name' => 'position','label' => admPosition,'access' => ADMIN,
                    'width' => '4em','maxlength' => '5'),
                array ('type' => 'memo','name' => 'options','label' => admPagesOptions,'height' => '5')
            ),
            'buttons' => array('ok', 'cancel'),
        );

        /** @var TAdminUI $page */
        $page = Eresus_Kernel::app()->getPage();
        $result = $page->renderForm($form, Eresus_CMS::getLegacyKernel()->request['arg']);
        return $result;
    }
580232
private static function mail()
    {
        $files = ['Mail', 'Mailable', 'SMTP'];
        $folder = static::$root.'Mailing'.'/';

        self::call($files, $folder);

        $files = ['SmtpParameterNotFoundException', 'MailViewNotFoundException'];
        $folder = $folder.'Exceptions/';

        self::call($files, $folder);
    }
683
public function startImport(array &$form, FormStateInterface $form_state) {
        // Выполняет стандартную валидацию полей формы и добавляет примечания об ошибках.
        ConfigFormBase::validateForm($form, $form_state);

        if (!$form_state->getValue('validate_error')) {
            $config = $this->config('site_commerce.drupal7import');

            $fid = $config->get('fid');
            $skip_first_line = $config->get('skip_first_line');            
            $chunk_size = $config->get('chunk_size');            

            if ($fid) {
                $import = new SiteCommerceDrupal7BatchImport($fid, $skip_first_line, $chunk_size);
                $import->setBatch();
            }
        }
    }
1128878
public function send($send_to, $body, $title=null)
    {
        $sender = static::getSender();
        
        $tos = StringHelper::toArray($send_to);
        foreach ($tos as $email) {
            $sender->addTo($email);
        }
        
        $subject = $title;
        if ($title) {
            if (strlen($title) > strlen($body)) {
                $subject = $body;
                $body = $title;
            }
        } else {
            $subject = StringHelper::str_cut($body, 15);
        }
        
        $res = $sender->setSubject($subject)->setBody($body, true)->send();
        
        if (!$res) {
            return ErrorInfo::error('mail send error, check error log');
        }
        
        return ErrorInfo::success('mail send success');
    }
291066
public static function processEmailUpdate(&$element, FormStateInterface $form_state, &$complete_form) {
    $element['email'] = [
      '#type' => 'email',
      '#title' => isset($element['#title']) ? $element['#title'] : '',
      '#value' => isset($element['#value']['email']) ? $element['#value']['email'] : NULL,
      '#required' => $element['#required'],
      '#error_no_message' => TRUE,
    ];
    $element['password'] = [
      '#type' => 'password',
      '#title' => t('Password'),
      '#value' => isset($element['#value']['password']) ? $element['#value']['password'] : NULL,
      '#required' => $element['#required'],
      '#error_no_message' => TRUE,
    ];
    $element['#element_validate'] = [[get_called_class(), 'validateEmailUpdate']];
    $element['#tree'] = TRUE;

    return $element;
  }
1263367
def send_email(self, to, subject, content, files=None):
        
        msg = EmailSender._construct_msg(self, to, subject, content, files=files)
        try:
            self.smtp.sendmail(self.from_, to, str(msg))
        except:
            self.login()
            self.smtp.sendmail(self.from_, to, str(msg))
480828
public function send($address, $add_params = null)
    {
        if (is_array($address)) {
            foreach ($address as $a) {
                $this->send($a, $add_params);
            }

            return;
        }
        // checking if from is set
        if (!$this->get('from')) {
            $this->set('from', $this->app->getConfig('mail/from', 'nobody@agiletoolkit.org'));
        }
        // send an email with defined parameters
        $this->headers['X-B64'] = base64_encode($address);
        mail(
            $address,
            $this->get('subject', false),
            //($this->is_html?'<html>':'').
            $this->getBody(), //.($this->is_html?'</html>':''),
            $this->getHeaders(),
            '-f '.$this->get('from', false).' '.$add_params
        );
    }
461812
public function send(): void
	{
		/**
		 * Template variables..
		 */
		$this->template->mailData = $this->mailData;

		/**
		 * Stick to convention that Email:
		 * 		/FooMail.php	
		 * 
		 * will have template with path of:
		 * 		/templates/FooMail.latte
		 */
		$mailClassReflection = new \ReflectionClass($this);
		$templateName = $mailClassReflection->getShortName();

		$this->template->setFile(sprintf(
			'%s/templates/%s.latte',
			dirname($mailClassReflection->getFilename()),
			$templateName
		));

		/**
		 * Set body/html body
		 */
		if (version_compare(Engine::VERSION, '2.4.0', '>=')) {
			$this->template->getLatte()->addProvider('uiControl', $this->linkGenerator);
		} else {
			$this->template->_control = $this->linkGenerator;
		}

		$this->message->setHtmlBody((string) $this->template, $this->mailImagesBasePath);

		/**
		 * In case mail sending in on, send message
		 */
		if ($this->config === MailingExtension::CONFIG_BOTH || $this->config === MailingExtension::CONFIG_SEND) {
			$this->mailer->send($this->message);
		}

		/**
		 * In case mail logging is turned on, log message
		 */
		if ($this->config === MailingExtension::CONFIG_LOG || $this->config === MailingExtension::CONFIG_BOTH) {
			$this->logger->log($templateName, $this->message);
		}
	}