Login   Register  
PHP Classes
elePHPant
Icontem

html and attachments

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us

      Nomad MIME Mail  >  All threads  >  html and attachments  >  (Un) Subscribe thread alerts  
Subject:html and attachments
Summary:html does not show when you add an attachment
Messages:3
Author:mwouters
Date:2010-02-05 14:29:22
Update:2011-12-23 15:34:50
 

  1. html and attachments   Reply   Report abuse  
Picture of mwouters
mwouters
2010-02-05 14:29:22
Hello,

When I send a message with your class, without an attachment, the mail shows in Thunderbird as html. However as soon as I add:

$mimemail->add_attachment("fpdf/files/filename2.pdf", "vote_".Simplify($title).".pdf");

the mail is shown in text instead of html. The text is taken from the html, because I didn't specify a $mimemail->set_text
A bug?

Here is my code:

$mimemail = new nomad_mimemail();
$mimemail->set_from($a_email, $a_firstname." ".$a_lastname);
$mimemail->set_to($a_email, $a_firstname." ".$a_lastname);

$mimemail->set_subject("Concerning your GPQA review of $title");

$msg_body = '
..my html here..
';

$mimemail->set_html("<HTML><HEAD></HEAD><BODY>$msg_body</BODY></HTML>");
$mimemail->add_attachment("fpdf/files/filename2.pdf", "vote_".Simplify($title).".pdf");

if ($mimemail->send()){
$msend="1";
}

Thanks a lot for any help,

Mark

  2. Re: html and attachments   Reply   Report abuse  
Picture of Fero Canik
Fero Canik
2010-05-12 21:15:27 - In reply to message 1 from mwouters
I have same problem when i send html mail with attachements. Maybe is problem a 7-bit encoding of e-mail. Any responses with fixes? thnx

  3. Re: html and attachments   Reply   Report abuse  
Picture of TKF
TKF
2011-12-23 15:34:50 - In reply to message 2 from Fero Canik
There is an errror _build_body function in nomad_mimemail_inc.php
There are two BRs, where should be one.
case 7 should look like these


$this->_build_header("Content-Type: multipart/mixed; boundary=\"$this->boundary_mix\"");
$this->mail_body .= "--" . $this->boundary_mix . BR;
$this->mail_body .= "Content-Type: multipart/alternative; boundary=\"$this->boundary_alt\"" . BR . BR;
$this->mail_body .= "--" . $this->boundary_alt . BR;
$this->mail_body .= "Content-Type: text/plain; charset=\"$this->charset\"" . BR;
$this->mail_body .= "Content-Transfer-Encoding: 8bit" . BR . BR;
$this->mail_body .= $this->mail_text . BR . BR;
$this->mail_body .= "--" . $this->boundary_alt . BR ;
$this->mail_body .= "Content-Type: text/html; charset=\"$this->charset\"" . BR;
$this->mail_body .= "Content-Transfer-Encoding: 7bit" . BR. BR;
$this->mail_body .= $this->mail_html . BR;
$this->mail_body .= "--" . $this->boundary_alt . "--" . BR . BR;
foreach($this->attachments as $value){
$this->mail_body .= "--" . $this->boundary_mix . BR;
$this->mail_body .= "Content-Type: " . $value['type'] . "; name=\"" . $value['name'] . "\"" . BR;
$this->mail_body .= "Content-Disposition: attachment; filename=\"" . $value['name'] . "\"" . BR;
$this->mail_body .= "Content-Transfer-Encoding: base64" . BR . BR;
$this->mail_body .= $value['content'] . BR . BR;
}
$this->mail_body .= "--" . $this->boundary_mix . "--" . BR;
break;

Notice only ONE BR after boundary before setting html mail value.