Email Attachments

the mail() function

Moderators: macek, egami, gesf

Post Reply
User avatar
gesf
Moderator
Moderator
Posts: 1717
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden
Contact:

Re: Email Attachments

Post by gesf » Sun Aug 10, 2008 11:47 am

Hey 2nejunkie,

I think this is happening because you're not sending the file's mime type.
Try this out:

Code: Select all

// Add this next line where you're "getting" the file data:
$attachment_type = $_FILES['attachment']['type'];

Code: Select all

// Replace 
$message .= "Content-Type: application/octet-stream;\n\tname=\"" . $attachment_name . "\"\n"; 

// With:
$message .= "Content-Type: " . $attachment_type . "; name=\"" . $attachment_name . "\"\n";
Hope it helps ;)

User avatar
gesf
Moderator
Moderator
Posts: 1717
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden
Contact:

Re: Email Attachments

Post by gesf » Sun Aug 10, 2008 12:54 pm

Yes, it should be in that part of the code.
Example:

Code: Select all

$attachment = $_FILES['attachment']['tmp_name'];
$attachment_name = $_FILES['attachment']['name'];
$attachment_type = $_FILES['attachment']['type'];

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests