@param string               $replyToAddress
@param OutgoingReplyContext $parentContext

@return OutgoingLogicalMessageContext
186239
public function createLogicalMessageContextFromReplyContext($replyToAddress, OutgoingReplyContext $parentContext)
    {
        return new OutgoingLogicalMessageContext(
            $parentContext->getMessageId(),
            $parentContext->getHeaders(),
            $parentContext->getLogicalMessage(),
            [new UnicastAddressTag($replyToAddress)],
            $parentContext->getReplyOptions()->isImmediateDispatchEnabled(),
            $parentContext->getIncomingPhysicalMessage(),
            $parentContext->getPendingTransportOperations(),
            $parentContext
        );
    }
1352905
public String getChargingStationAddress(MessageContext messageContext) {
        if (!(messageContext instanceof WrappedMessageContext)) {
            LOG.warn("Unable to get message context, or message context is not the right type.");
            return "";
        }

        Message message = ((WrappedMessageContext) messageContext).getWrappedMessage();
        List<Header> headers = CastUtils.cast((List<?>) message.get(Header.HEADER_LIST));

        for (Header h : headers) {
            Element n = (Element) h.getObject();

            if ("From".equals(n.getLocalName())) {
                return n.getTextContent();
            }
        }

        LOG.warn("No 'From' header found in request. Not able to determine charging station address.");
        return "";
    }
1013643
public function endpoint_sendmessage($to = NULL, $from = NULL, $body = NULL)
        {
            return $this->sendmessage($to, $from, $body);
        }
389743
public static function fromString(string $emailAddress): self
    {
        if (!preg_match('/^([^><]+?)\s*(?:<([^><]+)>)?$/', $emailAddress, $matches)) {
            throw new InvalidArgumentException(sprintf('"%s" is not a valid e-mail address.', $emailAddress));
        }

        return isset($matches[2]) ? new static($matches[2], $matches[1]) : new static($matches[1]);
    }
339997
protected static function executeFields(ExecutionContext $context, ObjectType $parent, $source, $fields)
    {
        return self::executeFieldsSerially($context, $parent, $source, $fields);
    }
1334043
public function queueCommands(ContextualCommandInterface $parentCommand): CommandInterface
    {
        if (!empty($this->instance)) {
            return $this->queueRelated($parentCommand);
        }

        if (!$this->schema[Record::NULLABLE]) {
            throw new RelationException("No data presented in non nullable relation");
        }

        $parentCommand->addContext($this->schema[Record::INNER_KEY], null);
        $parentCommand->addContext($this->schema[Record::MORPH_KEY], null);

        return new NullCommand();
    }
288482
private function sendEmail($to = '', $subject = '', $messageText = '')
    {
        $transport = $this->getServiceLocator()->get('mail.transport');
        $message = new Message();
            
        $message->addTo($to)
                ->addFrom($this->getOptions()->getSenderEmailAdress())
                ->setSubject($subject)
                ->setBody($messageText);

        $transport->send($message);
    }
1035100
public function sendMail($mailTo, $mailSubject, $mailMessage)
    {
        $config = $this->config;

        $mail_subject = '=?' . $config['charset'] . '?B?' . base64_encode($mailSubject) . '?=';
        $mail_message = chunk_split(base64_encode(preg_replace("/(^|(\r\n))(\.)/", "\1.\3", $mailMessage)));
        $headers = '';
        $headers .= "";
        $headers .= "MIME-Version:1.0\r\n";
        $headers .= "Content-type:text/html\r\n";
        $headers .= "Content-Transfer-Encoding: base64\r\n";
        $headers .= "From: " . $config['sitename'] . "<" . $config['mailfrom'] . ">\r\n";
        $headers .= "Date: " . date("r") . "\r\n";
        list($msec, $sec) = explode(" ", Cml::$nowMicroTime);
        $headers .= "Message-ID: <" . date("YmdHis", $sec) . "." . ($msec * 1000000) . "." . $config['mailfrom'] . ">\r\n";

        if (!$fp = fsockopen($config['server'], $config['port'], $errno, $errstr, 30)) {
            return ("CONNECT - Unable to connect to the SMTP server");
        }

        stream_set_blocking($fp, true);

        $lastmessage = fgets($fp, 512);
        if (substr($lastmessage, 0, 3) != '220') {
            return ("CONNECT - " . $lastmessage);
        }

        fputs($fp, ($config['auth'] ? 'EHLO' : 'HELO') . " befen\r\n");
        $lastmessage = fgets($fp, 512);
        if (substr($lastmessage, 0, 3) != 220 && substr($lastmessage, 0, 3) != 250) {
            return ("HELO/EHLO - " . $lastmessage);
        }

        while (1) {
            if (substr($lastmessage, 3, 1) != '-' || empty($lastmessage)) {
                break;
            }
            $lastmessage = fgets($fp, 512);
        }

        $email_from = '';

        if ($config['auth']) {
            fputs($fp, "AUTH LOGIN\r\n");
            $lastmessage = fgets($fp, 512);
            if (substr($lastmessage, 0, 3) != 334) {
                return ($lastmessage);
            }

            fputs($fp, base64_encode($config['username']) . "\r\n");
            $lastmessage = fgets($fp, 512);
            if (substr($lastmessage, 0, 3) != 334) {
                return ("AUTH LOGIN - " . $lastmessage);
            }

            fputs($fp, base64_encode($config['password']) . "\r\n");
            $lastmessage = fgets($fp, 512);
            if (substr($lastmessage, 0, 3) != 235) {
                return ("AUTH LOGIN - " . $lastmessage);
            }

            $email_from = $config['mailfrom'];
        }

        fputs($fp, "MAIL FROM: <" . preg_replace("/.*\<(.+?)\>.*/", "\\1", $email_from) . ">\r\n");
        $lastmessage = fgets($fp, 512);
        if (substr($lastmessage, 0, 3) != 250) {
            fputs($fp, "MAIL FROM: <" . preg_replace("/.*\<(.+?)\>.*/", "\\1", $email_from) . ">\r\n");
            $lastmessage = fgets($fp, 512);
            if (substr($lastmessage, 0, 3) != 250) {
                return ("MAIL FROM - " . $lastmessage);
            }
        }

        foreach (explode(',', $mailTo) as $touser) {
            $touser = trim($touser);
            if ($touser) {
                fputs($fp, "RCPT TO: <" . preg_replace("/.*\<(.+?)\>.*/", "\\1", $touser) . ">\r\n");
                $lastmessage = fgets($fp, 512);
                if (substr($lastmessage, 0, 3) != 250) {
                    fputs($fp, "RCPT TO: <" . preg_replace("/.*\<(.+?)\>.*/", "\\1", $touser) . ">\r\n");
                    $lastmessage = fgets($fp, 512);
                    return ("RCPT TO - " . $lastmessage);
                }
            }
        }

        fputs($fp, "DATA\r\n");
        $lastmessage = fgets($fp, 512);
        if (substr($lastmessage, 0, 3) != 354) {
            return ("DATA - " . $lastmessage);
        }

        fputs($fp, $headers);
        fputs($fp, "To: " . $mailTo . "\r\n");
        fputs($fp, "Subject: $mail_subject\r\n");
        fputs($fp, "\r\n\r\n");
        fputs($fp, "$mail_message\r\n.\r\n");
        $lastmessage = fgets($fp, 512);
        if (substr($lastmessage, 0, 3) != 250) {
            return ("END - " . $lastmessage);
        }

        fputs($fp, "QUIT\r\n");

        return true;
    }
1343233
protected function sendEmail(array $recipient, array $from, $subject, $bodyHTML = '', $bodyPlain = '', array $replyTo = NULL)
    {

        if ($replyTo == NULL) {
            $replyTo = $from;
        }
        $mail = GeneralUtility::makeInstance(MailMessage::class);
        $mail
            ->setTo($recipient)
            ->setFrom($from)
            ->setReplyTo($replyTo)
            ->setSubject($subject);

        if ($bodyHTML !== '' && $bodyHTML !== NULL ) {
            $mail->addPart($bodyHTML, 'text/html');
        }
        if ($bodyPlain !== '' && $bodyPlain !== NULL ) {
            $mail->addPart($bodyPlain, 'text/plain');
        }

        return $mail->send();
    }
169641
public function replyTo($emailAddress)
    {
        try {
            $this->mailer->AddReplyTo($emailAddress);
        } catch (phpmailerException $e) {
            throw new EmailException($e->getMessage(), $e->getCode());
        }

        return $this;
    }
159531
public function sendAddressCheckRequest(QuoteTransfer $quoteTransfer): AddressCheckResponseTransfer
    {
        $requestContainer = $this->riskCheckMapper->mapAddressCheck($quoteTransfer);
        $response = $this->executionAdapter->sendRequest($requestContainer);

        $responseContainer = $this->riskCheckFactory->createAddressCheckResponseContainer();
        $responseContainer->init($response);

        $addressCheckResponseTransfer = new AddressCheckResponseTransfer();
        $addressCheckResponseTransfer->setStatus($responseContainer->getStatus());
        $addressCheckResponseTransfer->setStreetName($responseContainer->getStreetName());
        $addressCheckResponseTransfer->setStreetNumber($responseContainer->getStreetNumber());
        $addressCheckResponseTransfer->setZip($responseContainer->getZip());
        $addressCheckResponseTransfer->setCity($responseContainer->getCity());
        $addressCheckResponseTransfer->setSecStatus($responseContainer->getSecstatus());
        $addressCheckResponseTransfer->setPersonStatus($responseContainer->getPersonstatus());

        if ($responseContainer->getCustomermessage() !== null) {
            $addressCheckResponseTransfer->setCustomerMessage($responseContainer->getCustomermessage());
        }

        return $addressCheckResponseTransfer;
    }
1075742
function addFromAddress(inboundMessage, outboundMessage) {
  if (inboundMessage && _.has(inboundMessage, 'from')) {
    outboundMessage.recipients = outboundMessage.recipients || [];

    outboundMessage.recipients.push(inboundMessage.from);
  }

  return outboundMessage;
}
862677
public function setSameParent(ModelInterface $receivingModel, ModelInterface $sourceModel, $parentTable)
    {
        if ($this->relationshipManager->isRoot($sourceModel)) {
            $this->relationshipManager->setRoot($receivingModel);

            return $this;
        }

        $this->relationshipManager->setSameParent($receivingModel, $sourceModel, $parentTable);

        return $this;
    }
383466
public function replaceOrderAddressWithCustomerAddress(string $orderAddressId, string $customerAddressId, Context $context): JsonResponse
    {
        $this->recalculationService->replaceOrderAddressWithCustomerAddress($orderAddressId, $customerAddressId, $context);

        return new JsonResponse(null, Response::HTTP_NO_CONTENT);
    }
827961
public function createPhysicalMessageContext($body, OutgoingLogicalMessageContext $parentContext)
    {
        return new OutgoingPhysicalMessageContext(
            $parentContext->getMessageId(),
            $parentContext->getHeaders(),
            new OutgoingPhysicalMessage($parentContext->getMessageId(), $parentContext->getHeaders(), $body),
            $parentContext->getAddressTags(),
            $parentContext->isImmediateDispatchEnabled(),
            $parentContext->getIncomingPhysicalMessage(),
            $parentContext->getPendingTransportOperations(),
            $parentContext
        );
    }
222980
public function getComments(LocaleEntity $locale, TranslatableEntity $translatable, TranslatableCommentEntity $parentComment = null)
    {
        $repo = $this->app->make(TranslatableCommentRepository::class);
        if ($parentComment === null) {
            $qb = $repo->createQueryBuilder('c');
            $qb
                ->where('c.translatable = :translatable')
                ->andWhere('c.parentComment is null')
                ->andWhere($qb->expr()->orX(
                    'c.locale = :locale',
                    'c.locale is null'
                ))
                ->orderBy('c.postedOn', 'ASC')
                ->setParameter('translatable', $translatable)
                ->setParameter('locale', $locale)
                ;
            $comments = $qb->getQuery()->getResult();
        } else {
            $comments = $repo->findBy(
                ['parentComment' => $parentComment],
                ['postedOn' => 'ASC']
            );
        }
        $result = [];
        $uh = $this->app->make(UserService::class);
        $dh = $this->app->make('helper/date');
        $me = new \User();
        $myID = $me->isRegistered() ? (int) $me->getUserID() : null;
        foreach ($comments as $comment) {
            $result[] = [
                'id' => $comment->getID(),
                'date' => $dh->formatPrettyDateTime($comment->getPostedOn(), true, true),
                'mine' => $myID && $myID === $comment->getPostedBy(),
                'by' => $uh->format($comment->getPostedBy()),
                'text' => $comment->getText(),
                'comments' => $this->getComments($locale, $translatable, $comment),
                'isGlobal' => $comment->getLocale() === null,
            ];
        }

        return $result;
    }
493553
public function sendAcceptSubscriptionRequest($to)
    {
        $presence = new \sb\XMPP\Presence();
        $presence->setType('subscribed');
        $presence->setTo($to);
        return $this->sendPresence($presence);
    }