From 07f5140771388c9e0c8a99b0dd2e5d950bdb173b Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Thu, 14 Oct 2021 15:16:42 +1100 Subject: moving h-source subdir out. --- .../swiftmailer/lib/classes/Swift/Attachment.php | 75 ++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100755 External/swiftmailer/lib/classes/Swift/Attachment.php (limited to 'External/swiftmailer/lib/classes/Swift/Attachment.php') diff --git a/External/swiftmailer/lib/classes/Swift/Attachment.php b/External/swiftmailer/lib/classes/Swift/Attachment.php new file mode 100755 index 0000000..d3779bf --- /dev/null +++ b/External/swiftmailer/lib/classes/Swift/Attachment.php @@ -0,0 +1,75 @@ +createDependenciesFor('mime.attachment') + ); + + $this->setBody($data); + $this->setFilename($filename); + if ($contentType) + { + $this->setContentType($contentType); + } + } + + /** + * Create a new Attachment. + * @param string|Swift_OutputByteStream $data + * @param string $filename + * @param string $contentType + * @return Swift_Mime_Attachment + */ + public static function newInstance($data = null, $filename = null, + $contentType = null) + { + return new self($data, $filename, $contentType); + } + + /** + * Create a new Attachment from a filesystem path. + * @param string $path + * @param string $contentType optional + * @return Swift_Mime_Attachment + */ + public static function fromPath($path, $contentType = null) + { + return self::newInstance()->setFile( + new Swift_ByteStream_FileByteStream($path), + $contentType + ); + } + +} -- cgit v1.2.3