1: <?php
2:
3: /**
4: * Jyxo PHP Library
5: *
6: * LICENSE
7: *
8: * This source file is subject to the new BSD license that is bundled
9: * with this package in the file license.txt.
10: * It is also available through the world-wide-web at this URL:
11: * https://github.com/jyxo/php/blob/master/license.txt
12: */
13:
14: namespace Jyxo\Mail\Email\Attachment;
15:
16: /**
17: * Inline mail attachment created from a file.
18: *
19: * @category Jyxo
20: * @package Jyxo\Mail
21: * @subpackage Email
22: * @copyright Copyright (c) 2005-2011 Jyxo, s.r.o.
23: * @license https://github.com/jyxo/php/blob/master/license.txt
24: * @author Jaroslav HanslĂk
25: */
26: class InlineFile extends \Jyxo\Mail\Email\Attachment
27: {
28: /**
29: * Type.
30: *
31: * @var string
32: */
33: protected $disposition = \Jyxo\Mail\Email\Attachment::DISPOSITION_INLINE;
34:
35: /**
36: * Creates an attachment.
37: *
38: * @param string $path Filename
39: * @param string $name Attachment name
40: * @param string $cid Id
41: * @param string $mimeType Attachment mime-type
42: */
43: public function __construct($path, $name, $cid, $mimeType = 'application/octet-stream')
44: {
45: $this->setContent(file_get_contents($path));
46: $this->setName($name);
47: $this->setCid($cid);
48: $this->setMimeType($mimeType);
49: }
50:
51: /**
52: * Sets Id.
53: *
54: * @param string $cid Id
55: * @return \Jyxo\Mail\Email\Attachment\File
56: */
57: public function setCid($cid)
58: {
59: $this->cid = (string) $cid;
60:
61: return $this;
62: }
63: }
64: