E-Mail mit Anhang verschicken

Die Methode addAttachment erwartet keinen String sondern ein Objekt vom Typ Zend_Mime_Part

public function addAttachment(Zend_Mime_Part $attachment)

Das kannst du einfach einfach aus einem String erzeugen:

    /**
     * create a new Mime Part.
     * The (unencoded) content of the Part as passed
     * as a string or stream
     *
     * @param mixed $content String or Stream containing the content
     */
    public function __construct($content)
    {
        $this->_content = $content;
        if (is_resource($content)) {
            $this->_isStream = true;
        }
    }

Wäre dann also:

$mail->AddAttachment(new \Zend_Mime_Part($content));

 

1 „Gefällt mir“