public function sendNewsletter(){ $contentArray = $this->f3->get('POST');
$this->f3->set('mailContent_attention',$contentArray['attention']); $this->f3->set('mailContent_headline',$contentArray['headline']);
$order = array("\r\n", "\n", "\r"); $replace = '<br />'; $contentArray['text'] = str_replace($order, $replace, $contentArray['text']);
$this->f3->set('mailContent_content',$contentArray['text']); // $recipient = $contentArray['recipient']; $recipients = explode(",", $contentArray['recipient']); // Encoding $this->smtp->set('Content-type', 'text/html; charset=UTF8'); // von wem $this->smtp->set('From','"domain.tld" <'.$this->f3->get('mailfrom').'>'); $this->smtp->set('Reply-To','<'.$this->f3->get('mailreply').'>'); // Betreff $this->smtp->set('Subject','Newsletter');
$file = 'logo.png';
$this->smtp->attach( './img/test/'.$file );
foreach ($recipients as $key => $value) {
$this->smtp->set('To', '<'.trim($value).'>');
if(!$this->smtp->send(\Template::instance()->render('/template/mail/newsletter.mail.template.html','text/html')))
return $value;
}
return true;
}
- Attachment ./img/test/logo.png not found
- basename() expects parameter 1 to be string, array given
i tried to figure out via getcwd() in which directory it starts, but no solution.
My image is located in : /app/ui/img/test
Regards,
Dee
EDIT: new error: file_get_contents() expects parameter 1 to be a valid path, array given
located in smtp class of fatfree at line 257
if (is_array($attachment['filename'])) { list($alias,$file)=each($attachment); $filename=$alias; $attachment['filename']=$file; } else $filename=basename($attachment); $out.='--'.$hash.$eol; $out.='Content-Type: application/octet-stream'.$eol; $out.='Content-Transfer-Encoding: base64'.$eol; if ($attachment['cid']) $out.='Content-ID: '.$attachment['cid'].$eol; $out.='Content-Disposition: attachment; '. 'filename="'.$filename.'"'.$eol; $out.=$eol; $out.=chunk_split( base64_encode(file_get_contents($attachment))).$eol; //line 257 }$mail->attach('image.png', null, '<myimage>');<img src="cid:myimage">Hi, no, not really, sorry.I see that the attach method has a $cid parameter that I assume is there exactly for that purpose since inline images on emails usually make use of the cid on the images src parameter.That being said, I just ran a quick test with an image and tried setting the cid parameter and then using it on an image src but it doesn't seem to work. Also, this last $cid parameter still isn't properly documented on F3's docs so I'm not sure how to use it.Maybe we can get some feedback from bcosca or some other collaborator regarding this.
F3 does support Content-ID headers