Sends mail about partner request to manager
@param array $mailVars
@param $sendFrom
@param $sendTo
428120
public function sendPartnerRequestToManager(array $mailVars, $sendFrom, $sendTo)
    {

        $mailTemplate = $this->createMailTemplate('partner-request-manager', $mailVars);

        if (!empty($mailTemplate)) {
            $subject = $mailTemplate->getSubject();
            $bodyParams = ['bodyContent' => $mailTemplate->getBody()];

            $this->sendMessage($sendFrom, $sendTo, $subject, $bodyParams);
        }


    }
926514
public function action(string $recipient, string $action, array $options = []): SendResponse
    {
        $this->isValidSenderAction($action);
        $options = $this->isValidOptions($options, $action);

        $request = new SendRequest($this->pageToken, $action, $recipient, $options, SendRequest::REQUEST_TYPE_ACTION);
        $response = $this->client->post('me/messages', $request->build());

        return new SendResponse($response);
    }
799600
public function send($toEmail, $toName, $subject, $view, array $data = array(), $options = null)
    {
        $this->mail->queue($view, $data, function ($message) use ($toEmail, $toName, $subject, $options) {

            $message->to($toEmail, $toName)
                    ->subject($subject);

            // Allow the caller to run additional functions
            // on the $msg SwiftMailer object (cc, bcc, attach, ...)
            if ($options && is_callable($options)) {
                call_user_func($options, $message);
            }
        });
    }
327437
public function sendMail($to, $subject, $view, $params = []): bool
    {
        if (empty($to)) {
            return false;
        }
        /** @var \yii\mail\MailerInterface $mailer */
        $mailer = $this->getMailer();
        return $mailer->compose(['html' => $view, 'text' => $view], $params)->setTo($to)->setSubject($subject)->send();
    }
1103126
private function sendTo(Swift_Mime_SimpleMessage $message, $reversePath, array $to, array &$failedRecipients)
    {
        if (empty($to)) {
            return 0;
        }

        return $this->doMailTransaction($message, $reversePath, array_keys($to),
            $failedRecipients);
    }
943158
public function send(
        Message $message,
        $setAsSent = true,
        $sendMail = true
    )
    {
        if (substr($receiversString = $message->getTo(), -1, 1) === ';') {
            $receiversString = substr_replace($receiversString, '', -1);
        }

        $receiversNames = explode(';', $receiversString);
        $usernames = array();
        $groupNames = array();
        $workspaceCodes = array();
        $userReceivers = array();
        $groupReceivers = array();
        $workspaceReceivers = array();

        //split the string of target into different array.
        foreach ($receiversNames as $receiverName) {
            if (substr($receiverName, 0, 1) === '{') {
                $groupNames[] = trim($receiverName, '{}');
            } else {
                if (substr($receiverName, 0, 1) === '[') {
                    $workspaceCodes[] = trim($receiverName, '[]');
                } else {
                    $usernames[] = $receiverName;
                }
            }
        }

        //get the different entities from the freshly created array.
        if (count($usernames) > 0) {
            $userReceivers = $this->userRepo->findByUsernames($usernames);
        }

        if (count($groupNames) > 0) {
            $groupReceivers = $this->groupRepo->findGroupsByNames($groupNames);
        }

        if (count($workspaceCodes) > 0) {
            $workspaceReceivers = $this->workspaceRepo->findWorkspacesByCode($workspaceCodes);
        }

        if (null !== $message->getParent()) {
            $message->setParent($message->getParent());
        }

        $this->om->persist($message);

        if ($setAsSent && $message->getSender()) {
            $userMessage = $this->om->factory('Claroline\MessageBundle\Entity\UserMessage');
            $userMessage->setIsSent(true);
            $userMessage->setUser($message->getSender());
            $userMessage->setMessage($message);
            $this->om->persist($userMessage);
        }

        $mailNotifiedUsers = array();

        //get every users which are going to be notified
        foreach ($groupReceivers as $groupReceiver) {
            $users = $this->userRepo->findByGroup($groupReceiver);

            foreach ($users as $user) {
                $userReceivers[] = $user;
            }
        }

        //workspaces are going to be notified
        foreach ($workspaceReceivers as $workspaceReceiver) {
            $users = $this->userRepo->findByWorkspaceWithUsersFromGroup($workspaceReceiver);

            foreach ($users as $user) {
                $userReceivers[] = $user;
            }
        }

        $ids = [];

        $filteredUsers = array_filter($userReceivers, function ($user) use (&$ids) {
            if (!in_array($user->getId(), $ids)) {
                $ids[] = $user->getId();

                return true;
            }
        });

        foreach ($filteredUsers as $filteredUser) {
            $userMessage = $this->om->factory('Claroline\MessageBundle\Entity\UserMessage');
            $userMessage->setUser($filteredUser);
            $userMessage->setMessage($message);
            $this->om->persist($userMessage);

            if ($filteredUser->isMailNotified()) {
                $mailNotifiedUsers[] = $filteredUser;
            }
        }

        if ($sendMail) {
            $this->mailManager->send(
                $message->getObject(),
                $message->getContent(),
                $mailNotifiedUsers,
                $message->getSender()
            );
        }

        $this->om->flush();

        return $message;
    }
434858
public function sendTextMsg($content, array $atMobiles = [], $isAtAll = false)
    {
        $query = [
            'msgtype' => 'text',
            'text' => [
                'content' => $content,
            ],
            'at' => [
                'isAtAll' => $isAtAll
            ],
        ];
        if (is_array($atMobiles) && count($atMobiles)>0) {
            $query['at']['atMobiles'] = $atMobiles;
        }
        return $this->sendMsg($query);
    }
327610
public function sendTemplateAsync($templateId, $sendEmail)
    {
        return $this->sendTemplateAsyncWithHttpInfo($templateId, $sendEmail)
            ->then(
                function ($response) {
                    return $response[0];
                }
            );
    }
1013333
public function sendOrderEmailToUser($oOrder, $sSubject = null)
    {
        self::$blSendToUserWasCalled = true;
        self::$oUserOrder = $oOrder;

        return self::$blRetValue;
    }
429282
private function SendTo($email)
    {
        $texts = array();
        $subject = Trans('Core.Forms.Form.DefaultSubject');
        $mailer = new PHPMailer();
        $mailer->isHTML(false);
        $mailer->CharSet = 'UTF-8';
        $mailer->setFrom($this->form->GetSendFrom());
        foreach($this->Elements()->GetElements() as $element)
        {
            if ($element instanceof Fields\Submit)
            {
                continue;
            }
            $name = $element->GetName();
            if ($name == 'Subject')
            {
                $subject = $this->Value($name);
            }
            else if ($name == 'ReplyTo')
            {
                $mailer->addReplyTo($this->Value($name));
            }
            $texts[] = $name . ": " . $this->Value($name);
        }
        $message = join("\r\n", $texts);
        $mailer->Subject = $subject;
        $mailer->Body = $message;
        $mailer->addAddress($email);
        $mailer->send();
    }
916928
public function send(
        $from_name,
        array $receivers,
        &$successfulRecipients,
        &$failedRecipients,
        $subject = '',
        $body = '',
        $content_type = 'text/html',
        $charset = 'UTF-8'
    )
    {
        $mailer = \Swift_Mailer::newInstance($this->transport);
        $message = \Swift_Message::newInstance();
        $message->setFrom([$this->_username => $from_name]);
        $message->setTo($receivers);
        $message->setSubject($subject);
        $message->setBody($body, $content_type, $charset);
        $successfulRecipients = $mailer->send($message, $failedRecipients);
        return true;
    }
716410
public void sendForm(HttpServletRequest req, HttpServletResponse res, String strReceiveMessage, Properties properties)
		throws ServletException, IOException
	{
		if (properties.getProperty(DESTINATION) == null)
		{		// Check to see if a param was set in get (ie., ?dest=xyz)
			String[] strParamDest = req.getParameterValues(DESTINATION);
			if ((strParamDest != null)
				&& (strParamDest.length > 0)
					&& (strParamDest[0] != null)
						&& (strParamDest[0].length() > 0))
							properties.setProperty(DESTINATION, strParamDest[0]);
		}
		super.sendForm(req, res, strReceiveMessage, properties);
	}
191803
public function send($subject, $body, array $users, $from = null, array $extra = array(), $force = false)
    {
        if ($this->isMailerAvailable()) {
            $body = $this->parseBodyUrl($body);

            $to = [];

            $layout = $this->contentManager->getTranslatedContent(array('type' => 'claro_mail_layout'));
            $fromEmail = $this->getMailerFrom();
            $locale = count($users) === 1 ? $users[0]->getLocale() : $this->ch->getParameter('locale_language');

            if (!$locale) {
                $locale = $this->ch->getParameter('locale_language');
            }

            $usedLayout = $layout[$locale]['content'];
            $body = str_replace('%content%', $body, $usedLayout);
            $body = str_replace('%platform_name%', $this->ch->getParameter('name'), $body);

            if ($from) {
                $body = str_replace('%first_name%', $from->getFirstName(), $body);
                $body = str_replace('%last_name%', $from->getLastName(), $body);
            } else {
                $body = str_replace('%first_name%', $this->ch->getParameter('name'), $body);
                $body = str_replace('%last_name%', '', $body);
            }

            foreach ($users as $user) {
                $mail = $user->getMail();

                if ($user->isMailValidated() || $force) {
                    $to[] = $mail;
                }
            }

            if (isset($extra['to'])) {
                foreach ($extra['to'] as $mail) {
                    if (filter_var($mail, FILTER_VALIDATE_EMAIL)) {
                        $to[] = $mail;
                    }
                }
            }

            $message = \Swift_Message::newInstance()
                ->setSubject($subject)
                ->setFrom($fromEmail)
                ->setBody($body, 'text/html');

            if ($from !== null && filter_var($from->getMail(), FILTER_VALIDATE_EMAIL)) {
                $message->setReplyTo($from->getMail());
            }

            if (count($to) > 1) {
                $message->setBcc($to);
            } else {
                $message->setTo($to);
            }

            if (isset($extra['attachment'])) {
                $message->attach(\Swift_Attachment::fromPath($extra['attachment'], "application/octet-stream"));
            }

            return $this->mailer->send($message) ? true : false;
        }

        return false;
    }
406410
public function sendHtml ($subject, $contentHTML, $to, $cc=array(), $bcc=array())
    {
        $firstErrorMsg = '';
        $lastErrorMsg  = '';

        // Try gateways in order
        foreach ($this->gateways as $gw) {
            try {
                $gw->sendHtml($subject, $contentHTML, $to, $cc, $bcc);

                // If previous function did not throw an exception, mail deportation was successfull
                return;

            } catch (\Exception $e) {
                // Sending failed, try, next gw, store error message
                if ('' === $firstErrorMsg) {
                    $firstErrorMsg = $e->getMessage();
                }
                $lastErrorMsg = $e->getMessage();
            }
        }

        // If we reach this point, we know all GWs failed
        throw new Exception("Sending email failed through all gateways (". count($this->gateways) ." configured).\n\nFirst error message: $firstErrorMsg\nLast error message: $lastErrorMsg");
    }
802066
public function sendMessage($to, $subject, $view, $params = [])
    {
        if (empty($to)) {
            return false;
        }
        /** @var \yii\mail\BaseMailer $mailer */
        $mailer = Yii::$app->mailer;
        $mailer->viewPath = $this->mailViewPath;
        $mailer->getView()->theme = Yii::$app->view->theme;
        $message = $mailer->compose(['html' => $view, 'text' => 'text/' . $view], $params)->setTo($to)->setSubject($subject);
        if ($this->mailSender != null) {
            $message->setFrom($this->mailSender);
        }
        return $message->send();
    }
924017
public function send($sMailTemplate, $sEmailList, $arDefaultEmailData = [], $sEmailDataEventName = null, $bCheckActiveLang = false)
    {
        if (empty($sEmailList) || (!is_string($sEmailList) && !is_array($sEmailList))) {
            return;
        }

        //Get template name
        $this->sMailTemplate = $sMailTemplate;
        if ($bCheckActiveLang) {
            $this->sMailTemplate = $this->addActiveLangSuffix($this->sMailTemplate);
        }

        //Get template data
        $this->arMailData = $this->getMailData($sEmailDataEventName, $arDefaultEmailData);

        //Process email list
        if (is_string($sEmailList)) {
            $arEmailList = explode(',', $sEmailList);
        } else {
            $arEmailList = $sEmailList;
        }

        foreach ($arEmailList as $sEmail) {
            $sEmail = trim($sEmail);

            $this->sendMail($sEmail);
        }
    }
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');
    }