@@ 2708-2730 (lines=23) @@ | ||
2705 | * @param string $disposition Disposition to use |
|
2706 | * @return void |
|
2707 | */ |
|
2708 | public function addStringAttachment( |
|
2709 | $string, |
|
2710 | $filename, |
|
2711 | $encoding = 'base64', |
|
2712 | $type = '', |
|
2713 | $disposition = 'attachment' |
|
2714 | ) { |
|
2715 | // If a MIME type is not specified, try to work it out from the file name |
|
2716 | if ($type == '') { |
|
2717 | $type = self::filenameToType($filename); |
|
2718 | } |
|
2719 | // Append to $attachment array |
|
2720 | $this->attachment[] = array( |
|
2721 | 0 => $string, |
|
2722 | 1 => $filename, |
|
2723 | 2 => basename($filename), |
|
2724 | 3 => $encoding, |
|
2725 | 4 => $type, |
|
2726 | 5 => true, // isStringAttachment |
|
2727 | 6 => $disposition, |
|
2728 | 7 => 0 |
|
2729 | ); |
|
2730 | } |
|
2731 | ||
2732 | /** |
|
2733 | * Add an embedded (inline) attachment from a file. |
|
@@ 2793-2818 (lines=26) @@ | ||
2790 | * @param string $disposition Disposition to use |
|
2791 | * @return boolean True on successfully adding an attachment |
|
2792 | */ |
|
2793 | public function addStringEmbeddedImage( |
|
2794 | $string, |
|
2795 | $cid, |
|
2796 | $name = '', |
|
2797 | $encoding = 'base64', |
|
2798 | $type = '', |
|
2799 | $disposition = 'inline' |
|
2800 | ) { |
|
2801 | // If a MIME type is not specified, try to work it out from the name |
|
2802 | if ($type == '') { |
|
2803 | $type = self::filenameToType($name); |
|
2804 | } |
|
2805 | ||
2806 | // Append to $attachment array |
|
2807 | $this->attachment[] = array( |
|
2808 | 0 => $string, |
|
2809 | 1 => $name, |
|
2810 | 2 => $name, |
|
2811 | 3 => $encoding, |
|
2812 | 4 => $type, |
|
2813 | 5 => true, // isStringAttachment |
|
2814 | 6 => $disposition, |
|
2815 | 7 => $cid |
|
2816 | ); |
|
2817 | return true; |
|
2818 | } |
|
2819 | ||
2820 | /** |
|
2821 | * Check if an inline attachment is present. |