コード例 #1
0
 function AddFromBinaryBody($bbody, $attachname, $mimetype, $isInline)
 {
     if (false !== $bbody && null !== $bbody) {
         $AttachType = $isInline ? MIMEConst_InlineLower : MIMEConst_AttachmentLower;
         $attachname = ConvertUtils::EncodeHeaderString($attachname, $GLOBALS[MailInputCharset], 'utf-8');
         $mimePart = new MimePart();
         $mimePart->Headers->SetHeaderByName(MIMEConst_ContentType, $mimetype . ';' . CRLF . "\t" . MIMEConst_NameLower . '="' . $attachname . '"', false);
         $mimePart->Headers->SetHeaderByName(MIMEConst_ContentTransferEncoding, MIMEConst_Base64Lower, false);
         $mimePart->Headers->SetHeaderByName(MIMEConst_ContentDisposition, $AttachType . ';' . CRLF . "\t" . MIMEConst_FilenameLower . '="' . $attachname . '"', false);
         $mimePart->_body = ConvertUtils::base64WithLinebreak($bbody);
         $this->List->Add(new Attachment($mimePart, $isInline));
         return true;
     }
     return false;
 }
コード例 #2
0
 /**
  * @return string
  */
 function SetEncodedBodyFromText($body, $charset = '')
 {
     //if ($charset == '') $charset = $GLOBALS[MailDefaultCharset];
     if ($charset == '') {
         $charset = $GLOBALS[MailInputCharset];
     }
     $body = preg_replace('/(<meta\\s.*)(charset\\s?=)([^"\'>\\s]*)/i', '$1$2' . $GLOBALS[MailOutputCharset], $body);
     $body = ConvertUtils::ConvertEncoding($body, $charset, $GLOBALS[MailOutputCharset]);
     $ContentTransferEncoding = MIMEConst_QuotedPrintableLower;
     if ($ContentTransferEncoding == MIMEConst_QuotedPrintableLower) {
         $this->Headers->SetHeaderByName(MIMEConst_ContentTransferEncoding, MIMEConst_QuotedPrintable);
         $this->_body = ConvertUtils::quotedPrintableWithLinebreak($body);
     } elseif ($ContentTransferEncoding == MIMEConst_Base64Lower) {
         $this->Headers->SetHeaderByName(MIMEConst_ContentTransferEncoding, MIMEConst_Base64);
         $this->_body = ConvertUtils::base64WithLinebreak($body);
     } else {
         $this->_body = $body;
     }
 }