Visualizzazione dei risultati da 1 a 3 su 3
  1. #1

    Invio mail con due allegati

    Ciao,
    utilizzo il seguente metodo per l'invio di una mail con allegato:


    codice:
    protected function sendAttachments(){
    			
    			$obj_dump = new dbdump;
    			$obj_dump->doDump();
    			$res_attachment = $obj_dump->str_filepath;
    			
    			$str_filez = fopen($res_attachment, "r");
    			$str_contents = fread($str_filez, filesize($res_attachment));
    			$encoded_attach = chunk_split(base64_encode($str_contents));
    			fclose($str_filez);
    			
    			$str_attach_name = 'dump.sql';
    			$str_object = 'Files';
    			
    			 
    			$str_head = 'From: SECURITY' . STR_DOMAIN_MAIL . "\n";
    			$str_head.= 'Reply-To: NOREPLY' . STR_DOMAIN_MAIL . "\n";
    			$str_head.= 'X-Mailer:' . STR_MAIL_CLIENT . "\n";
    			$str_head.= "MIME-version: 1.0\n";
    			$str_head.= "Content-type: multipart/mixed;\n";
    			$str_head.= " boundary=\"Message-Boundary\"\n";
    			$str_head.= "Content-transfer-encoding: 7BIT\n";
    			$str_head.= "X-attachments: $str_attach_name";
    			 		
    			$str_body = "--Message-Boundary\n";
    			$str_body.= "Content-type: text/html; charset=iso-8859-1\n";
    			$str_body.= "Content-transfer-encoding: 7BIT\n";
    			$str_body.= "Content-description: Mail message body\n\n";
    			$str_body.= "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">";
    			$str_body.= "<HTML><HEAD>";
    			$str_body.= "<META http-equiv=Content-Type content=\"text/html; charset=iso-8859-1\">";	
    			$str_body.= "</HEAD>";
    			$str_body.= "<BODY>";
    			$str_body.= LANG_NOREPLY_MAIL . "\n 
    ";
    			$str_body.= LANG_MSGMAIL_FILES . "\n 
    ";
    			$str_body.= "</BODY></HTML>";
    			$str_body.= "\n\n--Message-Boundary\n";
    			$str_body.= "Content-type: text/plain; name=\"$str_attach_name\"\n";
    			$str_body.= "Content-Transfer-Encoding: BASE64\n";
    			$str_body.= "Content-disposition: attachment; filename=\"$str_attach_name\"\n\n";
    			$str_body.= "$encoded_attach\n";
    			$str_body.= "--Message-Boundary--\n";
    			 
    			
    			if(mail(STR_TECHNICAL_MAIL, $str_object, $str_body, $str_head))
    			   return true;
    			else
    			   return false;
    		}

    Vorrei però modificarlo in modo da poter mandare 2 allegati. Come si può fare?

    Saluti,

    carlostefano

  2. #2
    up

  3. #3
    up up

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.