if(basename($PHP_SELF)== "class.html_mime_mail.inc")
{
include "fileinfo.inc";
echo "
<br> 如果不含圖檔:<br> \$mail = new html_mime_mail();<br> \$html =\"HTML內容\";<br> \$mail->add_html(\$html, \$text);<br> \$mail->build_message();<br> \$mail->send(收信人,收信Email,發信人,發信Email,標題,額外Header);<br> <br> <hr><br> 如果含圖檔:<br> \$url=\"www.cuti.com.my/AD/\"; //圖檔位?FONT color="#007700">} ?FONT color="#007700">}頭無http:// 結尾有斜線<br> \$path=\"/MAIL/AD/\"; //圖檔路徑 結尾有斜線<br> <br> \$filename1 = 'a.jpg';<br> \$backgrnd1 = fread(\$fp = fopen(\$path.\$filename1, 'r'), filesize(\$path.\$filename1));<br> fclose(\$fp);<br> ...依此類推...<br> \$filename6 = 'f.gif';<br> \$backgrnd6 = fread(\$fp = fopen(\$path.\$filename6, 'r'), filesize(\$path.\$filename6));<br> fclose(\$fp);<br> <br> \$mail->add_html_image(\$backgrnd1,\$filename1,'image/jpeg','http://'.\$url.\$filename1);<br> ...依此類推...<br> \$mail->add_html_image(\$backgrnd6,\$filename6,'image/gif','http://'.\$url.\$filename6);<br> <br> \$mail = new html_mime_mail();<br> \$html =\"HTML含圖內容\";<br> \$mail->add_html(\$html, \$text);<br> \$mail->build_message();<br> \$mail->send(收信人,收信Email,發信人,發信Email,標題,額外Header);<br> ";<br> <br> }<br> /***************************************<br> ** Title.........: HTML Mime Mail class<br> ** Version.......: 1.26<br> ** Author........: Richard Heyes <richard.heyes><br> ** Filename......: html_mime_mail.class<br> ** Last changed..: 25/06/2000<br> ** Notes.........: Based upon mime_mail.class<br> ** by Tobias Ratschiller <tobias><br> ** and Sascha Schumann <sascha>.<br> ** - Thanks to Thomas Flemming for supplying a fix<br> ** for Win32.<br> ** - Made headers terminated by CRLF instead of LF, now<br> ** compliant with RFC822. Thanks to Pao-Hsi Huang.<br> ** - Fixed bug; certain mail systems (gmx.net in particular)<br> ** were rejecting mail because of a space character either<br> ** side of the equal sign on the boundary line. Thanks to<br> ** Peter Holm for notifying me.<br> ** - Fixed bug; $html_images was tested to be an array or not<br> ** but was set to be an array during object creation, so the<br> ** test always returned true. Thanks to Bob Silva for<br> ** notifying me.<br> ** - Fixed bug; when looping with $obj->send(), From: headers<br> ** were accumulating. Bummer. Thanks to Lance Rasmussen for<br> ** notifying me.<br> ** - See http://www.heyes-computing.net/scripts/ for a zip/tar<br> ** containing an example script.<br> ***************************************/ <br> <br> class html_mime_mail{<br> <br> var $headers;<br> var $body;<br> var $multipart;<br> var $mime;<br> var $html;<br> var $html_text;<br> var $html_images = array();<br> var $cids = array();<br> var $do_html;<br> var $parts = array();<br> <br> /***************************************<br> ** Constructor function. Sets the headers<br> ** if supplied.<br> ***************************************/ <br> function html_mime_mail($headers = '){<br> $this->headers = $headers;<br> }<br> <br> /***************************************<br> ** Adds a html part to the mail.<br> ** Also replaces image names with<br> ** content-id's.<br> ***************************************/ <br> function add_html($html, $text){<br> $this->do_html = 1;<br> $this->html = $html;<br> $this->html_text = $text;<br> if(is_array($this->html_images) AND count($this->html_images) > 0){<br> /* for($i=0; $i<count>html_images); $i++){<br> $this->html = ereg_replace($this->html_images[$i]['name'], 'cid:'.$this->html_images[$i]['cid'], $this->html);<br> }<br> */ <br> }<br> }<br> <br> /***************************************<br> ** Builds html part of email.<br> ***************************************/ <br> function build_html($orig_boundary){<br> $sec_boundary = '=_'.md5(uniqid(time()));<br> $thr_boundary = '=_'.md5(uniqid(time()));<br> <br> if(count($this->html_images) == 0){<br> $this->multipart.= '--'.$orig_boundary. "\n";<br> $this->multipart.= 'Content-Type: multipart/alternative;'.chr(10).chr(9). 'boundary="'.$sec_boundary. "\"\n\n\n";<br> <br> // ttj added below <br> $this->multipart.= '--'.$thr_boundary. "\n";<br> $this->multipart.= 'Content-Type: text/plain'. "\n\n";<br> $this->multipart.= $this->html_text. "\n\n";<br> $this->multipart.= '--'.$thr_boundary. "--\n\n";<br> // ttj added above <br> $this->multipart.= '--'.$sec_boundary. "\n";<br> $this->multipart.= 'Content-Type: text/plain'. "\n";<br> $this->multipart.= 'Content-Transfer-Encoding: base64'. "\n\n";<br> $this->multipart.= chunk_split(base64_encode($this->html_text)). "\n\n";<br> // ttj added below <br> $this->multipart.= '--'.$thr_boundary. "\n";<br> $this->multipart.= 'Content-Type: text/html'. "\n\n";<br> $this->multipart.= $this->html. "\n\n";<br> $this->multipart.= '--'.$thr_boundary. "--\n\n";<br> // ttj added above <br> <br> $this->multipart.= '--'.$sec_boundary. "\n";<br> $this->multipart.= 'Content-Type: text/html'. "\n";<br> $this->multipart.= 'Content-Transfer-Encoding: base64'. "\n\n";<br> $this->multipart.= chunk_split(base64_encode($this->html)). "\n\n";<br> $this->multipart.= '--'.$sec_boundary. "--\n\n";<br> }else{<br> $this->multipart.= '--'.$orig_boundary. "\n";<br> $this->multipart.= 'Content-Type: multipart/related;'.chr(10).chr(9). 'boundary="'.$sec_boundary. "\"\n\n\n";<br> <br> $this->multipart.= '--'.$sec_boundary. "\n";<br> $this->multipart.= 'Content-Type: multipart/alternative;'.chr(10).chr(9). 'boundary="'.$thr_boundary. "\"\n\n\n";<br> <br> $this->multipart.= '--'.$thr_boundary. "\n";<br> $this->multipart.= 'Content-Type: text/plain'. "\n";<br> $this->multipart.= 'Content-Transfer-Encoding: base64'. "\n\n";<br> $this->multipart.= chunk_split(base64_encode($this->html_text)). "\n\n";<br> <br> // ttj added below <br> $this->multipart.= '--'.$thr_boundary. "\n";<br> $this->multipart.= 'Content-Type: text/html'. "\n\n";<br> $this->multipart.= $this->html. "\n\n";<br> $this->multipart.= '--'.$thr_boundary. "--\n\n";<br> // ttj added above <br> <br> $this->multipart.= '--'.$thr_boundary. "\n";<br> $this->multipart.= 'Content-Type: text/html'. "\n";<br> $this->multipart.= 'Content-Transfer-Encoding: base64'. "\n\n";<br> $this->multipart.= chunk_split(base64_encode($this->html)). "\n\n";<br> $this->multipart.= '--'.$thr_boundary. "--\n\n";<br> <br> for($i=0; $i<count>html_images); $i++){<br> $this->multipart.= '--'.$sec_boundary. "\n";<br> $this->build_html_image($i);<br> }<br> <br> $this->multipart.= "--".$sec_boundary. "--\n\n";<br> }<br> }<br> /***************************************<br> ** Adds an image to the list of embedded<br> ** images.<br> ***************************************/ <br> function add_html_image($file, $name = ', $c_type= 'application/octet-stream', $location= '){<br> $this->html_images[] = array( 'body' => $file,<br> 'name' => $name,<br> 'c_type' => $c_type,<br> 'location' => $location,<br> 'cid' => md5(uniqid(time())) );<br> }<br> <br> <br> /***************************************<br> ** Adds a file to the list of attachments.<br> ***************************************/ <br> function add_attachment($file, $name = ', $c_type= 'application/octet-stream'){<br> $this->parts[] = array( 'body' => $file,<br> 'name' => $name,<br> 'c_type' => $c_type );<br> }<br> <br> /***************************************<br> ** Builds an embedded image part of an<br> ** html mail.<br> ***************************************/ <br> function build_html_image($i){<br> $this->multipart.= 'Content-Type: '.$this->html_images[$i][ 'c_type'];<br> <br> if($this->html_images[$i][ 'name'] != ') $this->multipart .= '; name="'.$this->html_images[$i][ 'name']. "\"\n";<br> else $this->multipart .= "\n";<br> <br> $this->multipart.= 'Content-Transfer-Encoding: base64'. "\n";<br> $this->multipart.= 'Content-Location:'.$this->html_images[$i][ 'location']. "\n";<br> $this->multipart.= 'Content-ID: html_images[$i][ 'cid']. ">\n\n";<br> $this->multipart.= chunk_split(base64_encode($this->html_images[$i][ 'body'])). "\n";<br> }<br> <br> /***************************************<br> ** Builds a single part of a multipart<br> ** message.<br> ***************************************/ <br> function build_part($i){<br> $message_part = ';<br> $message_part.= 'Content-Type: '.$this->parts[$i][ 'c_type'];<br> if($this->parts[$i][ 'name'] != ')<br> $message_part .= '; name="'.$this->parts[$i][ 'name']. "\"\n";<br> else<br> $message_part .= "\n";<br> <br> // Determine content encoding. <br> if($this->parts[$i][ 'c_type'] == 'text/plain'){<br> $message_part.= 'Content-Transfer-Encoding: base64'. "\n\n";<br> $message_part.= chunk_split(base64_encode($this->parts[$i][ 'body'])). "\n";<br> }else{<br> $message_part.= 'Content-Transfer-Encoding: base64'. "\n";<br> $message_part.= 'Content-Disposition: attachment; filename="'.$this->parts[$i][ 'name']. "\"\n\n";<br> $message_part.= chunk_split(base64_encode($this->parts[$i][ 'body'])). "\n";<br> }<br> <br> return $message_part;<br> }<br> <br> /***************************************<br> ** Builds the multipart message from the<br> ** list ($this->parts).<br> ***************************************/ <br> function build_message(){<br> $boundary = '=_'.md5(uniqid(time()));<br> <br> $this->headers.= "MIME-Version: 1.0\n";<br> $this->headers.= "Content-Type: multipart/mixed;".chr(10).chr(9). "boundary=\"".$boundary. "\"\n";<br> $this->multipart = ';<br> // $this->multipart.= "This is a MIME encoded message.\nCreated by html_mime_mail.class.\nSee http://www.heyes-computing.net/scripts/ for a copy.\n\n"; <br> <br> if(isset($this->do_html) AND $this->do_html == 1) $this->build_html($boundary);<br> if(isset($this->body) AND $this->body != ') $this->parts[] = array( 'body' => $this->body, 'name' => ', 'c_type' => 'text/plain');<br> <br> for($i=(count($this->parts)-1); $i>=0; $i--){<br> $this->multipart.= '--'.$boundary. "\n".$this->build_part($i);<br> }<br> <br> $this->mime = $this->multipart. "--".$boundary. "--\n";<br> }<br> <br> /***************************************<br> ** Sends the mail.<br> ***************************************/ <br> function send($to_name, $to_addr, $from_name, $from_addr, $subject = ', $headers = '){<br> <br> if($to_name != ') $to = '"'.$to_name. '" ';<br> else $to = $to_addr;<br> <br> if($from_name != ') $from = '"'.$from_name. '" ';<br> else $from = $from_addr;<br> <br> mail($to, $subject, $this->mime, 'From: '.$from. "\n".$headers. "\n".$this->headers);<br> }<br> <br> /***************************************<br> ** Use this method to deliver using direct<br> ** smtp connection. Relies upon Manuel Lemos'<br> ** smtp mail delivery class available at:<br> ** http://phpclasses.upperdesign.com<br> **<br> ** void smtp_send( string *Name* of smtp object,<br> ** string From address,<br> ** array To addresses,<br> ** string Subject)<br> ***************************************/ <br> function smtp_send($smtp_obj, $from_addr, $to_addr, $subject){<br> global $$smtp_obj;<br> $smtp_obj = $$smtp_obj;<br> <br> $this->headers .= 'From: '.$from_addr. "\n";<br> $this->headers .= 'Subject: '.$subject. "\n";<br> <br> if(substr($this->headers, -2) == "\n") $this->headers = substr($this->headers,0,-2);<br> $this->headers = explode( "\n", $this->headers);<br> <br> $smtp_obj->sendmessage($from_addr, $to_addr, $this->headers, $this->mime);<br> }<br> <br> } // End of class. <br> ?><br> </count></count></sascha></tobias></richard.heyes>

PHP异步发送邮件:避免长时间等待邮件发送完成。导言:在Web开发中,发送邮件是常见的功能之一。但是,由于邮件发送需要与服务器进行通信,往往会导致用户在等待邮件发送完成的过程中出现长时间的等待。为了解决这个问题,我们可以使用PHP异步发送邮件的方式来优化用户体验。本文将介绍如何通过具体的代码示例实现PHP异步发送邮件,并避免长时间的等待。一、理解异步发送邮件

我们最近一直在谈论微软计划添加到其最新操作系统Windows11中的许多功能。但是,不要以为微软只会添加什么也不收回。事实上,这家软件巨头开始删除相当多的旧功能。在宣布计划在Windows12发布之前停用MSDT功能后,雷德蒙德开发人员带来了更多的坏消息。我们实际上是在谈论远程邮件槽旧版工具。当我们说您实际上想知道这一点时,请相信我们。Microsoft已开始在内部版本25314中弃用此功能我们相信您还记得,就在几天前,微软在其新的金丝雀频道发布了内部版本25314。上述版本包含许多新功能

最近,许多用户报告了Outlook邮件卡在发件箱中的问题。即使多次尝试发送电子邮件,问题也没有得到解决。当您看到此问题并检查您的发件箱文件夹时,该消息将卡在那里。电子邮件卡在Outlook发件箱中的可能原因是:电子邮件中的附件超过了大小限制,这会减慢发送过程。邮件服务器的Outlook帐户身份验证问题Outlook或邮件服务器脱机Outlook中的发送/接收设置不正确。其他一些软件正在使用Outlook数据文件。防病毒软件会扫描传出的电子邮件。如果这个问题一直困扰着您并且您无法发送电子邮

PHP邮件追踪功能:了解用户对邮件的行为和反馈在现代社会中,电子邮件已经成为人们日常生活和工作中必不可少的一部分。对于企业来说,发送邮件是与客户进行沟通、推广产品或服务的重要方式之一。然而,一封邮件被发送出去后,我们如何知道它是否被收到、被读取,或者用户对邮件内容有何反应?这时,邮件追踪功能就显得尤为重要了。邮件追踪功能可以帮助我们了解用户对邮件的行为和反馈

作为更新Windows11原生应用程序的一部分,微软计划发布新的Outlook。该应用程序是从头开始制作的,现在正在为预览版做准备,这可能会在微软的Windows11混合活动期间宣布。该项目被称为“ProjectMonarch”,这个新的Outlook已经开发了一年多。这是网络应用程序的重新启动,旨在统一所有现有的Windows电子邮件客户端,例如邮件和日历以及桌面版Outlook。通过OutlookOne,微软希望帮助用户跨不同的桌面平台管理他们的电子邮件。有很多方法可以访问

PHP和PHPMAILER:如何实现邮件发送的自动过滤功能?在现代社会中,电子邮件已成为人们交流的重要方式之一。然而,随着电子邮件的流行和广泛使用,垃圾邮件的数量也呈现出爆炸式增长的趋势。垃圾邮件不仅会浪费用户的时间和网络资源,还可能带来病毒和钓鱼行为。因此,在开发邮件发送功能时,加入自动过滤垃圾邮件的功能变得至关重要。本文将介绍如何使用PHP和PHPMai

为什么我的Windows11邮件应用程序无法运行?邮件应用无法在Windows11中运行的潜在原因有很多。当该应用根本无法启动时,可能是因为系统文件损坏。或者应用程序本身可能已过时或以某种方式损坏。Windows11包括可以解决此类问题的工具和修复选项。Windows11Mail应用程序不发送电子邮件可能是由于许多同步问题。例如,某些第三方防病毒软件和防火墙可能会阻止应用程序同步电子邮件和日历。此类安全实用程序还可能导致WindowsMail应用程序不下载附件。由于某

一些 Windows 用户在尝试将 Gmail 或任何其他电子邮件帐户添加到 Windows PC 上的邮件应用程序时报告了错误消息“出现问题,我们很抱歉,但我们无法做到这一点”以及错误代码0x80070490 在屏幕上。即使经过多次尝试,客户也无法将任何电子邮件帐户添加到他们的邮件应用程序中。用户非常不满意,并且不确定如何从这里转移。在邮件应用程序中添加电子邮件帐户时出现此错误的可能原因可能是系统数据文件损坏、邮件应用程序的一些内部问题、过时的邮件应用程序等。在分析了上述可能导致此错误的原因后


熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

AI Hentai Generator
免費產生 AI 無盡。

熱門文章

熱工具

MantisBT
Mantis是一個易於部署的基於Web的缺陷追蹤工具,用於幫助產品缺陷追蹤。它需要PHP、MySQL和一個Web伺服器。請查看我們的演示和託管服務。

DVWA
Damn Vulnerable Web App (DVWA) 是一個PHP/MySQL的Web應用程序,非常容易受到攻擊。它的主要目標是成為安全專業人員在合法環境中測試自己的技能和工具的輔助工具,幫助Web開發人員更好地理解保護網路應用程式的過程,並幫助教師/學生在課堂環境中教授/學習Web應用程式安全性。 DVWA的目標是透過簡單直接的介面練習一些最常見的Web漏洞,難度各不相同。請注意,該軟體中

SublimeText3 英文版
推薦:為Win版本,支援程式碼提示!

SAP NetWeaver Server Adapter for Eclipse
將Eclipse與SAP NetWeaver應用伺服器整合。

Dreamweaver Mac版
視覺化網頁開發工具