Re: [PHP] Sending email w/ attachments
Check out this link http://www.learnphp-tutorial.com/Email.cfm On Tue, Aug 11, 2009 at 8:52 AM, Skip Evans s...@bigskypenguin.com wrote: Bastien Koert wrote: Use PHPMailer or one of the other classes available...makes life so much easier eric cartman Kick Ass!!! /eric cartman Yes! Wow! Was that a breeze! That class rocks! Thanks tons, Bastien! I have to admit when I first saw your reply I thought, Oh, man, another class to learn? But I know this is so close to working. I look at the sample and thought, This looks easy, and had it working in no time. Big thanks again! Attachments were a big deal here and this makes it a breeze, AND it looks like multiple attachments would be no problem? Very cool! Skip -- Skip Evans Big Sky Penguin, LLC 503 S Baldwin St, #1 Madison WI 53703 608.250.2720 http://bigskypenguin.com Those of you who believe in telekinesis, raise my hand. -- Kurt Vonnegut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Devendra Jadhav
Re: [PHP] Sending email w/ attachments
Hi, Very cool! I'll take that as a compliment... :-) -- Richard Heyes HTML5 graphing: RGraph - www.rgraph.net (updated 8th August) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sending email w/ attachments
On Aug 10, 2009, at 11:22 PM, Skip Evans s...@bigskypenguin.com wrote: Bastien Koert wrote: Use PHPMailer or one of the other classes available...makes life so much easier eric cartman Kick Ass!!! /eric cartman Yes! Wow! Was that a breeze! That class rocks! Thanks tons, Bastien! I have to admit when I first saw your reply I thought, Oh, man, another class to learn? But I know this is so close to working. I look at the sample and thought, This looks easy, and had it working in no time. Big thanks again! Attachments were a big deal here and this makes it a breeze, AND it looks like multiple attachments would be no problem? Very cool! Skip -- Skip Evans Big Sky Penguin, LLC 503 S Baldwin St, #1 Madison WI 53703 608.250.2720 http://bigskypenguin.com Those of you who believe in telekinesis, raise my hand. -- Kurt Vonnegut Yep, I created a wrapper for the class and pass in attachments as an array. Then just loop thru the array with the attachment code. It's very easy. Bastien Sent from my iPod -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sending email w/ attachments
Hi, ... Sorry, quoted wrong email. Oopsy... -- Richard Heyes HTML5 graphing: RGraph - www.rgraph.net (updated 8th August) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sending email w/ attachments
Hey all, Trying to send emails with attachments, first try at this. And am trying to adapt sample code I found here: http://www.webcheatsheet.com/PHP/send_email_text_html_attachment.php Trying this: ($data contains the contents of the file; I've verified this) $hash = md5(date('r', time())); $attachment = chunk_split(base64_encode($data)); $body_attachment = --PHP-mixed-$hash--\n . Content-Type: application/octet-stream; name=\$filename\\r\n . Content-Transfer-Encoding: base64\n . Content-Disposition: attachment\n. $attachment . \n . --PHP-mixed-$hash--\n; I then append $attachment this to the end of the email body and send it on. I've verified it is reading the file properly, in this test case it is a place text file. But I've tried a PDF and that did not work as well. What happens is the email comes through and shows an attachment paper clip icon in Thunderbird, but when the email is clicked on the icon disappears and the email is empty, even the body is not there and no attachment either. A final question I have is does the content-type value need to change for text files, Word Docs, PDFs, Excel files, etc, or is there one type that can handle any file type? Any help would be great. I'm rather stuck and floundering here. Thanks, Skip -- Skip Evans Big Sky Penguin, LLC 503 S Baldwin St, #1 Madison WI 53703 608.250.2720 http://bigskypenguin.com Those of you who believe in telekinesis, raise my hand. -- Kurt Vonnegut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sending email w/ attachments
On Mon, Aug 10, 2009 at 9:49 PM, Skip Evanss...@bigskypenguin.com wrote: Hey all, Trying to send emails with attachments, first try at this. And am trying to adapt sample code I found here: http://www.webcheatsheet.com/PHP/send_email_text_html_attachment.php Trying this: ($data contains the contents of the file; I've verified this) $hash = md5(date('r', time())); $attachment = chunk_split(base64_encode($data)); $body_attachment = --PHP-mixed-$hash--\n . Content-Type: application/octet-stream; name=\$filename\\r\n . Content-Transfer-Encoding: base64\n . Content-Disposition: attachment\n. $attachment . \n . --PHP-mixed-$hash--\n; I then append $attachment this to the end of the email body and send it on. I've verified it is reading the file properly, in this test case it is a place text file. But I've tried a PDF and that did not work as well. What happens is the email comes through and shows an attachment paper clip icon in Thunderbird, but when the email is clicked on the icon disappears and the email is empty, even the body is not there and no attachment either. A final question I have is does the content-type value need to change for text files, Word Docs, PDFs, Excel files, etc, or is there one type that can handle any file type? Any help would be great. I'm rather stuck and floundering here. Thanks, Skip -- Skip Evans Big Sky Penguin, LLC 503 S Baldwin St, #1 Madison WI 53703 608.250.2720 http://bigskypenguin.com Those of you who believe in telekinesis, raise my hand. -- Kurt Vonnegut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Use PHPMailer or one of the other classes available...makes life so much easier -- Bastien Cat, the other other white meat -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sending email w/ attachments
Funny, I just had to figure out today how to nicely do HTML e-mails. I ended up using PEAR:Mail_mime, and it worked pretty well. It will also work for your attachments. I believe that PHP itself recommends it on their mail() function reference page. Adam. On Mon, Aug 10, 2009 at 6:49 PM, Skip Evanss...@bigskypenguin.com wrote: Hey all, Trying to send emails with attachments, first try at this. And am trying to adapt sample code I found here: http://www.webcheatsheet.com/PHP/send_email_text_html_attachment.php Trying this: ($data contains the contents of the file; I've verified this) $hash = md5(date('r', time())); $attachment = chunk_split(base64_encode($data)); $body_attachment = --PHP-mixed-$hash--\n . Content-Type: application/octet-stream; name=\$filename\\r\n . Content-Transfer-Encoding: base64\n . Content-Disposition: attachment\n. $attachment . \n . --PHP-mixed-$hash--\n; I then append $attachment this to the end of the email body and send it on. I've verified it is reading the file properly, in this test case it is a place text file. But I've tried a PDF and that did not work as well. What happens is the email comes through and shows an attachment paper clip icon in Thunderbird, but when the email is clicked on the icon disappears and the email is empty, even the body is not there and no attachment either. A final question I have is does the content-type value need to change for text files, Word Docs, PDFs, Excel files, etc, or is there one type that can handle any file type? Any help would be great. I'm rather stuck and floundering here. Thanks, Skip -- Skip Evans Big Sky Penguin, LLC 503 S Baldwin St, #1 Madison WI 53703 608.250.2720 http://bigskypenguin.com Those of you who believe in telekinesis, raise my hand. -- Kurt Vonnegut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Adam Randall http://www.xaren.net AIM: blitz574 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sending email w/ attachments
Bastien Koert wrote: Use PHPMailer or one of the other classes available...makes life so much easier eric cartman Kick Ass!!! /eric cartman Yes! Wow! Was that a breeze! That class rocks! Thanks tons, Bastien! I have to admit when I first saw your reply I thought, Oh, man, another class to learn? But I know this is so close to working. I look at the sample and thought, This looks easy, and had it working in no time. Big thanks again! Attachments were a big deal here and this makes it a breeze, AND it looks like multiple attachments would be no problem? Very cool! Skip -- Skip Evans Big Sky Penguin, LLC 503 S Baldwin St, #1 Madison WI 53703 608.250.2720 http://bigskypenguin.com Those of you who believe in telekinesis, raise my hand. -- Kurt Vonnegut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php