PDA

View Full Version : email attachment via php


Billy T
07-20-2003, 01:04 AM
Hey all

I thought this would be easy and I've found a wealth of information on the subject but I just can't get it to work. I receive the email and there is a pdf file attached but its 1k and is corrupt (down the bottom of the email there is a broken image icon)

here's my code

$headers = "MIME-Version: 1.0\r\n";

$headers .= "Content-Type: multipart/mixed; boundary=\"XX-1234DED00099A\";\r\n";
$headers .= "Content-Transfer-Encoding: 7bit\r\n";
$headers .= "From: $adminaddress\r\n";

//This sends a confirmation to your visitor
$confirmMessage="This is a MIME Encoded Message

--XX-1234DED00099A
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

html formatted text message goes here


--XX-1234DED00099A
Content-Type: application/octet-stream;
name=subscription_payment.pdf\r\n
Content-Transfer-Encoding: base64\r\n
Content-Description: \"Subscription payment form\"\r\n
Content-Disposition: Attachment; subscription_payment.pdf\r\n


--XX-1234DED00099A-";
mail("$email","Welcome to blah blah",
$confirmMessage,$headers);

can anyone see what I'm doing wrong?

Thanks

freddycodes
07-20-2003, 01:34 AM
Billy, I just sent you an email. I think you might be smarter to use an existing class for sending attachments. It might be easier to get it going, then learn how it works later. I sent you one I use.

Billy T
07-20-2003, 01:46 AM
awesome thanks freddy!

your test worked a treat - now I just have to implement it with my form - shouldn't be difficult

Thanks again!!

freddycodes
07-20-2003, 01:53 AM
Sure thing, and there is that API.txt file in the zip that shows how to use it. BTW I got it from devscripts.com.


The mimePart.php is another class, which can be used to build the mime mail from the ground up, it does not have the easier API that the htmlMimeMail class puts on top of it.

Billy T
07-20-2003, 02:03 AM
Originally posted by freddycodes
it does not have the easier API that the htmlMimeMail class puts on top of it.

well it works an absolute treat! (and even I can sort of understand it!)

Thanks again mate

CyanBlue
07-20-2003, 03:09 AM
Fess up what you did, Billy T... I wanna know as well... :D

Billy T
07-20-2003, 03:38 AM
what I did? I posted my problem here and freddy fixed it for me :)

I'll email you the files

cheers

red penguin
07-20-2003, 10:43 AM
freddycodes to the rescue...

CyanBlue
07-20-2003, 07:45 PM
As always... And we thank you for that, freddycodes... ;)

CyanBlue
02-02-2004, 10:08 AM
Hey, Billy T... :)

I saw hangalot's post today and remembered this thread...
http://www.actionscript.org/forums/showthread.php3?s=&threadid=41036

Care to share what you have found out so that we all can be benefited??? :)

Billy T
02-02-2004, 10:13 AM
didn't I email you the files already?

Billy T
02-02-2004, 10:16 AM
they're on that thread now anyway so if anyone needs them go there ;)

cheers

CyanBlue
02-02-2004, 10:27 AM
Thanks alot... :)

(Not sure if I've got the email attachment from you last time or not, but I wasn't using this crappy computer lasy July... My work station decided to off of me, so I am on my backup computer right now... :( )

Billy T
02-02-2004, 10:34 AM
dang that sux

oh well...at least you don't suffer the daily heartbreak of using Flash on a mac...

CyanBlue
02-02-2004, 10:49 AM
Hahaha... Oh, come on... You love Mac... That's why you use Flash on Mac, right??? Then enjoy the consequence... :p

Billy T
02-02-2004, 10:51 AM
I'll be enjoying the consequences of a new G5 soon ;)

CyanBlue
02-02-2004, 10:53 AM
WoW... That sounds awesome... Can you send me your old Mac then??? :D

Billy T
02-02-2004, 10:55 AM
sure... if you send me a couple of grand to cover the shipping ;)

CyanBlue
02-02-2004, 11:01 AM
Oh... Okay... Here are your grands...

:D :D :D