mirror of
https://github.com/anonaddy/anonaddy
synced 2026-04-26 01:25:06 +02:00
49 lines
986 B
PHP
49 lines
986 B
PHP
<?php
|
|
|
|
namespace App\CustomMailDriver\Mime\Part;
|
|
|
|
use Symfony\Component\Mime\Header\Headers;
|
|
use Symfony\Component\Mime\Part\DataPart;
|
|
|
|
class InlineImagePart extends DataPart
|
|
{
|
|
/**
|
|
* Sets the content-id of the file.
|
|
*
|
|
* @return $this
|
|
*/
|
|
public function setContentId(string $cid): static
|
|
{
|
|
$this->cid = $cid;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* Sets the name of the file.
|
|
*
|
|
* @return $this
|
|
*/
|
|
public function setFileName(string $filename): static
|
|
{
|
|
$this->filename = $filename;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getPreparedHeaders(): Headers
|
|
{
|
|
$headers = parent::getPreparedHeaders();
|
|
|
|
if (null !== $this->cid) {
|
|
$headers->setHeaderBody('Id', 'Content-ID', $this->cid);
|
|
}
|
|
|
|
if (null !== $this->filename) {
|
|
$headers->setHeaderParameter('Content-Disposition', 'filename', $this->filename);
|
|
}
|
|
|
|
return $headers;
|
|
}
|
|
}
|