DraftEmail example

use PHPUnit\Framework\TestCase;
use Symfony\Component\Mime\DraftEmail;
use Symfony\Component\Mime\Exception\LogicException;

/** * @author Kevin Bond <kevinbond@gmail.com> */
final class DraftEmailTest extends TestCase
{
    public function testCanHaveJustBody()
    {
        $email = (new DraftEmail())->text('some text')->toString();

        $this->assertStringContainsString('some text', $email);
        $this->assertStringContainsString('MIME-Version: 1.0', $email);
        $this->assertStringContainsString('X-Unsent: 1', $email);
    }

    public function testBccIsRemoved()
    {
        $email = (new DraftEmail())->text('some text')->bcc('sam@example.com')->toString();

        $this->assertStringNotContainsString('sam@example.com', $email);
    }
Home | Imprint | This part of the site doesn't use cookies.