Hi All,

Im in the middle of making a dynamic multi part email and have come accross a snag.

The function receives a file, and depending on the content of that file it then processes the relevant headers and mixed parts, however, rather than echoing the items i need to put them into variables.

there are two examples below, 1 being plain text, the other is the same but in a variable. If I call the variable it will not attach. Only when I use the plain text it will attach.

Can anybody see the difference


Plain text

Content-Type: application/<?php echo $filetype;?>; name="<?php echo $filename; ?>" 
Content-Transfer-Encoding: base64 
Content-Disposition: attachment

the variables

$attachment_header = "Content-Type: application/" . $filetype . "; name=\"" . $filename . "\"\r\n ";
$attachment_header .= "Content-Transfer-Encoding: base64 Content-Disposition: attachment";
echo $attachment_header;

Recommended Answers

All 2 Replies

New line before content-disposition ? And doesn't it need a content-length ?

on this occasion ill accept the prize of todays biggest loser. i was missing the \r\n

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.