@@ 2602-2624 (lines=23) @@ | ||
2599 | * |
|
2600 | * @return void |
|
2601 | */ |
|
2602 | public function addStringAttachment( |
|
2603 | $string, |
|
2604 | $filename, |
|
2605 | $encoding = 'base64', |
|
2606 | $type = '', |
|
2607 | $disposition = 'attachment' |
|
2608 | ) { |
|
2609 | //If a MIME type is not specified, try to work it out from the file name |
|
2610 | if ($type == '') { |
|
2611 | $type = self::filenameToType($filename); |
|
2612 | } |
|
2613 | // Append to $attachment array |
|
2614 | $this->attachment[] = [ |
|
2615 | 0 => $string, |
|
2616 | 1 => $filename, |
|
2617 | 2 => basename($filename), |
|
2618 | 3 => $encoding, |
|
2619 | 4 => $type, |
|
2620 | 5 => true, // isStringAttachment |
|
2621 | 6 => $disposition, |
|
2622 | 7 => 0, |
|
2623 | ]; |
|
2624 | } |
|
2625 | ||
2626 | /** |
|
2627 | * Add an embedded (inline) attachment from a file. |
|
@@ 2693-2719 (lines=27) @@ | ||
2690 | * |
|
2691 | * @return bool True on successfully adding an attachment |
|
2692 | */ |
|
2693 | public function addStringEmbeddedImage( |
|
2694 | $string, |
|
2695 | $cid, |
|
2696 | $name = '', |
|
2697 | $encoding = 'base64', |
|
2698 | $type = '', |
|
2699 | $disposition = 'inline' |
|
2700 | ) { |
|
2701 | //If a MIME type is not specified, try to work it out from the name |
|
2702 | if ($type == '') { |
|
2703 | $type = self::filenameToType($name); |
|
2704 | } |
|
2705 | ||
2706 | // Append to $attachment array |
|
2707 | $this->attachment[] = [ |
|
2708 | 0 => $string, |
|
2709 | 1 => $name, |
|
2710 | 2 => $name, |
|
2711 | 3 => $encoding, |
|
2712 | 4 => $type, |
|
2713 | 5 => true, // isStringAttachment |
|
2714 | 6 => $disposition, |
|
2715 | 7 => $cid, |
|
2716 | ]; |
|
2717 | ||
2718 | return true; |
|
2719 | } |
|
2720 | ||
2721 | /** |
|
2722 | * Check if an inline attachment is present. |