[PHP] Email with attachment
Hi, I found a good function at php.net that sends email with atachment, but unfortunately i still cannot figure out how to send a body of the email too. Here is the code: function sendEmailWithAttachement($to, $subject, $message, $file) { if (strtoupper(substr(PHP_OS,0,3)=='WIN')) { $eol=\r\n; } elseif (strtoupper(substr(PHP_OS,0,3)=='MAC')) { $eol=\r; } else { $eol=\n; } $filename = basename($file); displaymessage($filename); $file_size = filesize($file); $file_type = filetype($file); displaymessage($file_size); $handle = fopen($file, rb); $content = fread($handle, $file_size); $content = chunk_split(base64_encode($content)); fclose($handle); # Common Headers $headers = 'From: cont...@example.com'.$eol; $headers .= 'Reply-To: cont...@example.com'.$eol; $headers .= 'Return-Path: cont...@example.com'.$eol; // these two to set reply address $headers .= Message-ID: .time(). TheSystem@.$_SERVER['SERVER_NAME']..$eol; $headers .= X-Mailer: PHP v.phpversion().$eol; // These two to help avoid spam-filters # Boundry for marking the split Multitype Headers $mime_boundary=md5(time()); $headers .= 'MIME-Version: 1.0'.$eol; $headers .= Content-Type: multipart/related; boundary=\.$mime_boundary.\.$eol; $msg = ; # Attachment $msg .= --.$mime_boundary.$eol; $msg .= Content-Type: .$file_type.; name=\.$filename.\.$eol; // sometimes i have to send MS Word, use 'msword' instead of 'pdf' $msg .= Content-Transfer-Encoding: base64.$eol; $msg .= $message; $msg .= Content-Disposition: attachment; filename=\.$filename.\.$eol.$eol; // !! This line needs TWO end of lines !! IMPORTANT !! $msg .= $content.$eol.$eol; # Setup for text OR html $msg .= Content-Type: multipart/alternative.$eol; # Text Version $msg .= --.$mime_boundary.$eol; $msg .= Content-Type: text/plain; charset=iso-8859-1.$eol; $msg .= Content-Transfer-Encoding: 8bit.$eol; $msg .= This is a multi-part message in MIME format..$eol; $msg .= If you are reading this, please update your email-reading-software..$eol; $msg .= + + Text Only + +.$eol.$eol; # Finished $msg .= --.$mime_boundary.--.$eol.$eol; // finish with two eol's for better security. see Injection. mail($to, $subject, $msg, $headers); } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Excel Report Formatting
Hi, Do you know if there is a way to generate a formated Excel report. I want some rows to be of different colors than the others. Thank you __ Get the name you've always wanted @ymail.com or @rocketmail.com! Go to http://ca.promos.yahoo.com/jacko/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Excel Report Formatting
Hi Tommy, The code in the link is traightforward. The problem is you need to install ADOdb. I'm wondering if there is a way to do it from scratch. Thanks - Original Message From: Tommy Pham tommy...@gmail.com To: Php Developer pdevelo...@rocketmail.com; php-general@lists.php.net Sent: Tue, April 20, 2010 11:37:21 AM Subject: RE: [PHP] Excel Report Formatting -Original Message- From: Php Developer [mailto:pdevelo...@rocketmail.com] Sent: Tuesday, April 20, 2010 8:30 AM To: php-general@lists.php.net Subject: [PHP] Excel Report Formatting Hi, Do you know if there is a way to generate a formated Excel report. I want some rows to be of different colors than the others. Thank you __ Get the name you've always wanted @ymail.com or @rocketmail.com! Go to http://ca.promos.yahoo.com/jacko/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php http://www.phpeveryday.com/articles/Write-report-in-Excel-Format-Part-1--P155.html __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Excel Report Formatting
Hi, somebody knows if it is possible to open excel content in a new window? what i want is basically initialize the headers and instead of echo $content i want it to open in a new window. is that possible? - Original Message From: Tommy Pham tommy...@gmail.com To: Php Developer pdevelo...@rocketmail.com; php-general@lists.php.net Sent: Tue, April 20, 2010 1:47:40 PM Subject: RE: [PHP] Excel Report Formatting -Original Message- From: Php Developer [mailto:pdevelo...@rocketmail.com] Sent: Tuesday, April 20, 2010 9:52 AM To: Tommy Pham; php-general@lists.php.net Subject: Re: [PHP] Excel Report Formatting Hi Tommy, The code in the link is traightforward. The problem is you need to install ADOdb. I'm wondering if there is a way to do it from scratch. Thanks - Original Message From: Tommy Pham tommy...@gmail.com To: Php Developer pdevelo...@rocketmail.com; php- gene...@lists.php.net Sent: Tue, April 20, 2010 11:37:21 AM Subject: RE: [PHP] Excel Report Formatting -Original Message- From: Php Developer [mailto:pdevelo...@rocketmail.com] Sent: Tuesday, April 20, 2010 8:30 AM To: php-general@lists.php.net Subject: [PHP] Excel Report Formatting Hi, Do you know if there is a way to generate a formated Excel report. I want some rows to be of different colors than the others. Thank you __ Get the name you've always wanted @ymail.com or @rocketmail.com! Go to http://ca.promos.yahoo.com/jacko/ http://www.phpeveryday.com/articles/Write-report-in-Excel-Format-Part- 1--P155.html I think the article/sample uses PEAR's Excel Writer. http://pear.php.net/package/Spreadsheet_Excel_Writer/ http://pear.php.net/manual/en/package.fileformats.spreadsheet-excel-writer.spreadsheet-excel-writer-format.setfgcolor.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] array or list of objects of different types
Hi all, I want to be able to have an array of elements of different types. As an example: the first element is a boolean, the second is an integer, and the thirs is a string. In php there is no typing, i'm just wondering if there is a way to have that, it would be a lot better than having an array of strings and have to convert each element. Thank you __ The new Internet Explorer® 8 - Faster, safer, easier. Optimized for Yahoo! Get it Now for Free! at http://downloads.yahoo.com/ca/internetexplorer/
[PHP] Change displayed file name to download
Hi, I'm using the following code: $fp = fopen($filename, 'r+'); $content = fread($fp, filesize($filename)); fclose($fp); header(Content-type: application/msword); header(Content-Disposition: attachment; filename=$filename); echo $content; exit; ___ Now when downloading a file the default name that appears for the user is the realname of the file i the server with the real path the only difference is that the slashes are modified by underscore. My question is: is there any way how to control the name that will be displayed for the customer? Or at least skip the path and display just the file's name? Thank you __ Be smarter than spam. See how smart SpamGuard is at giving junk email the boot with the All-new Yahoo! Mail. Click on Options in Mail and switch to New Mail today or register for free at http://mail.yahoo.ca
[PHP] Are IP addresses reliable?
I wanna know that is there a way to forge someone's IP address? for example, I have a client with an static ip address, and she is a superuser. Can i rely on her IP address? or somebody else can forge her IP? I don't want her to enter a username and a password.. Cheers, Daniel - Park yourself in front of a world of choices in alternative vehicles. Visit the Yahoo! Auto Green Center.
[PHP] People's misbehavior on the list
some people don't remove the Re: prefix when answering to the questions It opens a new topic on the list and that's not appropriate . Thank ya - Moody friends. Drama queens. Your life? Nope! - their life, your story. Play Sims Stories at Yahoo! Games.
[PHP] Imp
hello all, As we know, there are a lot of php design patterns(more than 20). I want to know that which patterns are important and necessary for ZCE exam. PHP5 Study Guide only covers Singleton,Factory,Registry,MVC and ActiveRecord. But i still feel that more patterns are necessary for the exam. Cheers, Daniel - Expecting? Get great news right away with email Auto-Check. Try the Yahoo! Mail Beta.
[PHP] Important Design Patterns
hello all, As we know, there are a lot of php design patterns(more than 20). I want to know that which patterns are important and necessary for ZCE exam. PHP5 Study Guide only covers Singleton,Factory,Registry,MVC and ActiveRecord. But i still feel that more patterns are necessary for the exam. Cheers, Daniel - Food fight? Enjoy some healthy debate in the Yahoo! Answers Food Drink QA.
[PHP] Important Design Patterns
hello all, As we know, there are a lot of php design patterns(more than 20). I want to know that which patterns are important and necessary for ZCE exam. PHP5 Study Guide only covers Singleton,Factory,Registry,MVC and ActiveRecord. But i still feel that more patterns are necessary for the exam. Cheers, Daniel - Finding fabulous fares is fun. Let Yahoo! FareChase search your favorite travel sites to find flight and hotel bargains.