devo fare una newsletter che invii a 10.000 utenti una email con un allegato preso dal database mysql.
linguaggio di programmazione = PHP 5.0.2
server dedicato: Windows 2003 Standard Edition
dall'articolo http://freephp.html.it/articoli/view...sp?id=70&pag=4
invece che leggere un file dal disco, è possibile inserire uno o più allegati prendendoli dal database?Codice PHP:// APRIAMO L'ALLEGATO PER LEGGERLO E CODIFICARLO
$file = @fopen($attach, "r");
$contents = @fread($file, $file_size);
$encoded_attach = chunk_split(base64_encode($contents));
@fclose($file);
qui l'allegato è uno solo, se devo inserire 3 o 4 allegati come faccio?Codice PHP:// INTESTAZIONI DELLA MAIL
$mail_headers .= "MIME-version: 1.0\n";
$mail_headers .= "Content-type: multipart/mixed; boundary=\"$boundary\"";
$mail_headers .= "X-attachments: $file_name\n";
se devo inserire più files, come intestazione devo mettere qualcosa del genere?Codice PHP:// COSTRUIAMO IL CORPO DELLA MAIL
//...
$mail_body .= "Content-type: $file_type; name=\"$file_name\"\n";
$mail_body .= "Content-Transfer-Encoding: base64\n";
$mail_body .= "$encoded_attach\n";
$mail_body .= "--$boundary--\n";
tale applicazione inoltre sfrutterà una marea di risorse, quali accorgimenti sono necessari per farla funzionare?Codice PHP:// file 1
$mail_body .= "Content-type: $file_1_type; name=\"$file_1_name\"\n";
$mail_body .= "Content-Transfer-Encoding: base64\n";
$mail_body .= "$encoded_1_attach\n";
$mail_body .= "--$boundary--\n";
// file 2
$mail_body .= "Content-type: $file_2_type; name=\"$file_2_name\"\n";
$mail_body .= "Content-Transfer-Encoding: base64\n";
$mail_body .= "$encoded_2_attach\n";
$mail_body .= "--$boundary--\n";
// file 3
$mail_body .= "Content-type: $file_3_type; name=\"$file_3_name\"\n";
$mail_body .= "Content-Transfer-Encoding: base64\n";
$mail_body .= "$encoded_3_attach\n";
$mail_body .= "--$boundary--\n";
tenete sempre presente che tale applicazione gira su un server dedicato acquistato solo ed esclusivamente per questa applicazione.

Rispondi quotando