Baby Jai
08-16-2003, 10:22 PM
I dont know what I should name the PHP's. Also I have the one that is an application and it looks great, whats the html to add a file upload box? Once that is done I need to create another PHP like a miler.php, but im type confused. So all I have to do is edit the mailer php? So then what is the actual code for it then?
This is it, but its really confusing.
$mime_boundary = "<<<--==+X[".md5(time())."]";
Sort out your basic headers as usual, by piling them into a $headers string.
$headers .= "From: Automatic <an.e.mail@domain.net>\r\n";
$headers .= "To: SomeName <an.e.mail@domain.net>\r\n";
Then you've got to specify the type of content you're dealing with. This is also put into the $headers string. In this case, it will be mixed between text, and some kind of attachment, hence the Content-Type bit. The boundary bit uses the boundary variable you made earlier:
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: multipart/mixed;\r\n";
$headers .= " boundary=\"".$mime_boundary."\"";
Next, get on with piling the message into a $message string. You need quite a bit of header looking stuff in here. The first bit is what is displayed if the client receiveing the email doesn't support MIME, followed by the boundary string (preceded by "--", not sure why).
$message .= "This is a multi-part message in MIME format.\r\n";
$message .= "\r\n";
$message .= "--".$mime_boundary."\r\n";
Next comes the actual content of the email, each part needs it's own mini header describing what it is.
$message .= "Content-Type: text/plain; charset=\"iso-8859-1\"\r\n";
$message .= "Content-Transfer-Encoding: 7bit\r\n";
$message .= "\r\n";
$message .= "Email content and what not: \r\n";
$message .= "This is the file you asked for! \r\n";
$message .= "--".$mime_boundary."\r\n";
Finally, a plaintext attachment. In this case I already put your contents into $fileContent.
$message .= "Content-Type: application/octet-stream;\r\n";
$message .= " name=\"filename.extn\"\r\n";
$message .= "Content-Transfer-Encoding: quoted-printable\r\n";
$message .= "Content-Disposition: attachment;\r\n";
$message .= " filename=\"filename.extn\"\r\n";
$message .= "\r\n";
$message .= $fileContent;
$message .= "\r\n";
$message .= "--".$mime_boundary."\r\n";
Then send the thing, using the mail function as described in the manual. You will probably have to have a few goes at this before you get it right. The linbreaks need to be exactly right for this to work, and if it doesn't, that's probably why.
$ok = mail("an.e.mail@domain.net", "file by email", $message, $headers);
This is it, but its really confusing.
$mime_boundary = "<<<--==+X[".md5(time())."]";
Sort out your basic headers as usual, by piling them into a $headers string.
$headers .= "From: Automatic <an.e.mail@domain.net>\r\n";
$headers .= "To: SomeName <an.e.mail@domain.net>\r\n";
Then you've got to specify the type of content you're dealing with. This is also put into the $headers string. In this case, it will be mixed between text, and some kind of attachment, hence the Content-Type bit. The boundary bit uses the boundary variable you made earlier:
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: multipart/mixed;\r\n";
$headers .= " boundary=\"".$mime_boundary."\"";
Next, get on with piling the message into a $message string. You need quite a bit of header looking stuff in here. The first bit is what is displayed if the client receiveing the email doesn't support MIME, followed by the boundary string (preceded by "--", not sure why).
$message .= "This is a multi-part message in MIME format.\r\n";
$message .= "\r\n";
$message .= "--".$mime_boundary."\r\n";
Next comes the actual content of the email, each part needs it's own mini header describing what it is.
$message .= "Content-Type: text/plain; charset=\"iso-8859-1\"\r\n";
$message .= "Content-Transfer-Encoding: 7bit\r\n";
$message .= "\r\n";
$message .= "Email content and what not: \r\n";
$message .= "This is the file you asked for! \r\n";
$message .= "--".$mime_boundary."\r\n";
Finally, a plaintext attachment. In this case I already put your contents into $fileContent.
$message .= "Content-Type: application/octet-stream;\r\n";
$message .= " name=\"filename.extn\"\r\n";
$message .= "Content-Transfer-Encoding: quoted-printable\r\n";
$message .= "Content-Disposition: attachment;\r\n";
$message .= " filename=\"filename.extn\"\r\n";
$message .= "\r\n";
$message .= $fileContent;
$message .= "\r\n";
$message .= "--".$mime_boundary."\r\n";
Then send the thing, using the mail function as described in the manual. You will probably have to have a few goes at this before you get it right. The linbreaks need to be exactly right for this to work, and if it doesn't, that's probably why.
$ok = mail("an.e.mail@domain.net", "file by email", $message, $headers);