Jump to content


Arckyz

Member Since 19/12/2004
Offline Last Active 13/02/2010, 12:16
-----

Posts I've Made

In Topic: Enviar E-Mail Com Anexo (Atualizado!)

13/08/2009, 16:21

COmo fasso para colocar mais anexos? tentei fazer isso:

$verifica_ext = true;
$c = 1;
$arq[1] = $anexo;
$arq[2] = $anexo2;
$arq[3] = $anexo3;
$arq[4] = $anexo4;
$arq[5] = $anexo5;
while ($c < 6){
$attachments[1] = $arq[$c];
foreach ($attachments as $key => $full_path) {
if ($full_path !='') {
	  if (file_exists($full_path)){
			if ($fp = fopen($full_path,"rb")) {
					$filename = array_pop(explode(chr(92),$full_path));
					$contents = fread($fp,filesize($full_path));
					$encoded = base64_encode($contents);
					$encoded_split = chunk_split($encoded);
					fclose($fp);
					$message .= "--$boundary\n";
					$message .= "Content-Type: $anexo_type\n";
					$message .= "Content-Disposition: attachment; filename=\"$anexo_name\" \n";
					$message .= "Content-Transfer-Encoding: base64\n\n";
					$message .= "$encoded_split\n";
					$extensao = substr($anexo_name,-4);
					if ($extensao != ".jpg" && $extensao != ".png" && $extensao != "jpeg" && $extensao != ".gif" && $anexo_name != ""){
					  $verifica_ext = false;	
					}
					
			}
			else {
			echo "Impossível abrir o arquivo$key: $filename";
			$ABORT = TRUE;
			}
	  }
	  else {
	  echo "O arquivo$key não existe: $filename";
	  $ABORT = TRUE;
	  }
}
}
$c++;
}


porém os arquivos vem todos com o mesmo nome e se eu colocar um arquivo q nao seja foto no 2º ou 3º anexo que nao seja foto ele nao percebe e envia do msm jeito

IPB Skin By Virteq