Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x

MessagePart.php

Namespace

Symfony\Component\Mime\Part

File

vendor/symfony/mime/Part/MessagePart.php

View source
<?php


/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
namespace Symfony\Component\Mime\Part;

use Symfony\Component\Mime\Message;
use Symfony\Component\Mime\RawMessage;

/**
 * @final
 *
 * @author Fabien Potencier <fabien@symfony.com>
 */
class MessagePart extends DataPart {
    public function __construct(RawMessage $message) {
        if ($message instanceof Message) {
            $name = $message->getHeaders()
                ->getHeaderBody('Subject') . '.eml';
        }
        else {
            $name = 'email.eml';
        }
        parent::__construct('', $name);
    }
    public function getMediaType() : string {
        return 'message';
    }
    public function getMediaSubtype() : string {
        return 'rfc822';
    }
    public function getBody() : string {
        return $this->message
            ->toString();
    }
    public function bodyToString() : string {
        return $this->getBody();
    }
    public function bodyToIterable() : iterable {
        return $this->message
            ->toIterable();
    }
    public function __sleep() : array {
        return [
            'message',
        ];
    }
    public function __wakeup() : void {
        $this->__construct($this->message);
    }

}

Classes

Title Deprecated Summary
MessagePart @final

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal