search
HomePHP LibrariesOther librariesphp attachment email class
php attachment email class
<? 
class CMailFile {  
  
  var $subject;  
  var $addr_to;  
  var $text_body;  
  var $text_encoded;  
  var $mime_headers;  
  var $mime_boundary = "--==================_846811060==_";  
  var $smtp_headers;  
    
  function CMailFile($subject,$to,$from,$msg,$filename,$downfilename,$mimetype = "application/octet-stream",$mime_filename = false) {  
    $this->subject = $subject;     
    $this->addr_to = $to;     
    $this->smtp_headers = $this->write_smtpheaders($from); 
    $this->text_body = $this->write_body($msg); 
    $this->text_encoded = $this->attach_file($filename,$downfilename,$mimetype,$mime_filename); 
    $this->mime_headers = $this->write_mimeheaders($filename, $mime_filename); 
  }  
  
  function attach_file($filename,$downfilename,$mimetype,$mime_filename) { 
    $encoded = $this->encode_file($filename); 
    if ($mime_filename) $filename = $mime_filename; 
    $out = "--" . $this->mime_boundary . "\n"; 
    $out = $out . "Content-type: " . $mimetype . "; name=\"$filename\";\n"; 
    $out = $out . "Content-Transfer-Encoding: base64\n"; 
    $out = $out . "Content-disposition: attachment; filename=

This is a php attachment email class, friends who need it can download and use

Disclaimer

All resources on this site are contributed by netizens or reprinted by major download sites. Please check the integrity of the software yourself! All resources on this site are for learning reference only. Please do not use them for commercial purposes. Otherwise, you will be responsible for all consequences! If there is any infringement, please contact us to delete it. Contact information: admin@php.cn

Related Article

What are some very useful class libraries or tool libraries for PHP?What are some very useful class libraries or tool libraries for PHP?

06Jul2016

What are some very useful class libraries or tool libraries for PHP?

Are there PHP libraries to help validate email addresses?Are there PHP libraries to help validate email addresses?

25Nov2024

PHP Libraries for Email Address ValidationValidating email addresses can be a challenging task, especially if you need to adhere to industry...

Which PHP Library Best Fits Your Email Address Validation Needs?Which PHP Library Best Fits Your Email Address Validation Needs?

18Nov2024

PHP Email Address Validation Libraries UncoveredEmail address validation plays a crucial role in data validation, but creating a...

How Do I Link Static Libraries That Depend on Other Static Libraries?How Do I Link Static Libraries That Depend on Other Static Libraries?

13Dec2024

Linking Static Libraries to Other Static Libraries: A Comprehensive ApproachStatic libraries provide a convenient mechanism to package reusable...

Why is my HTML email from PHP showing up blank in Gmail with an unwanted 'noname' attachment?Why is my HTML email from PHP showing up blank in Gmail with an unwanted 'noname' attachment?

09Nov2024

Troubleshooting HTML Email Sending with PHPYou're encountering issues sending HTML emails from PHP using your provided code. The result is a blank...

PhpMailer vs. SwiftMailer: Which PHP Email Library Reigns Supreme?PhpMailer vs. SwiftMailer: Which PHP Email Library Reigns Supreme?

18Oct2024

Email Delivery in PHP: PhpMailer vs. SwiftMailerWhen faced with the task of sending emails in PHP, two popular libraries emerge: PhpMailer and SwiftMailer. Choosing the right tool for the job can be crucial, but which one offers a clear advantage?Php

See all articles