Re: mail() and file attachments

From: Date: Fri, 29 Sep 2000 17:21:19 +0000
Subject: Re: mail() and file attachments
Groups: php.general 
Request: Send a blank email to php-general+get-18081@lists.php.net to get a copy of this message
Randy <randy@secretISP.com> said: > Anyone ever do this? Whats involved? > > Thanks > > Randy > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > Try out the class for sending MIME standard e-mails from Richard Heyes at http://www.heyes-computing.net/scripts/ It works beautifully and with it you can send: HTML Email HTML Email with embedded images HTML Email with attachments HTML Email with embedded images and attachments Text email Text email with attachments Watch out if you are using an Windows based ISP: I couldn't figure out why my attachments were being all cut. When you open files that shall be attached, instead of issuing the following command for loading the file $backgrnd = fread($fp = fopen($filename, 'r'), filesize($filename)); you should use $backgrnd = fread($fp = fopen($filename, 'rb'), filesize($filename)); Most certainly 'b' here stands for 'binary'. There is a very visible note about this on the example, but all I can say is that I lost a lot of time trying to figure out what the problem was before actually noticing it. Also: at this particular project I'm working on (ISP runs Windows NT and PHP4.0.2) the function 'mail()' from PHP does not work. I haven't come out to a definitive conclusion, but I believe the *PHP mail function does not work under M$* (anyone correct me if I'm wrong), or it may be some particularity at my ISP (?) (I tested sending e-mail from within ASP scripts and they work). So I started using an SMTP class from Manuel Lemos with which you can send messages using the SMTP server directly. It also works beautifully and is actually the class that Richard Heyes distributed along with his MIME class so that you also have a method for sending e-mails directly with SMTP. Both classes are just great, everything you need for what you want. Cheers, Paulo Parola --

« previous php.general (#18081) next »