Jump to content

Email Attachments .dat


kamaxo

Recommended Posts

hi there. this is my first post.

 

i'm sory for my english (i'm portuguese)

 

i have i very bad situation. on my code.

i'm sending an email from my aplication and when arrives to the client the Attachments is send with the extension ".dat".

 

in my pc the email is sent correct. but from other pc (server) the extension arrives ".dat".

 

does anyone have the same problem ???

please help me.

 

tnks

Link to comment
https://forums.phpfreaks.com/topic/222897-email-attachments-dat/
Share on other sites

This is my code.

 

include("Mail.php"); 
include("Mail/mime.php"); 

$text = ""; 
$html = "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
	<html xmlns='http://www.w3.org/1999/xhtml'>
	<head>
	<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1' />
	<title></title>

	<style type='text/css'>
	#footer {0 0 repeat-x ; width:90%; font-family:'lucida grande',tahoma,verdana,arial,sans-serif; font-size:10px; text-transform:uppercase;  padding:2px; }

	</style>
	</head>
	<body>
	<div align='center'>
											$msg
										</div>

	</body>
	</html>";


$crlf = "\r\n"; 
$hdrs = array( 
				  "From"    => $emailempresaprincipal->email, 
				  "Subject" => $subj ,
				  "To" => "$to",
				  "Cc" => "$cc_",
				  "Bcc" => "bcc_"
				  ); 

	$mime = new Mail_mime($crlf); 

	if ($ficheiro_){
		foreach($_FILES['ficheiro_']['name'] as $key => $name) {
			$tipo = substr($_FILES['ficheiro_']['type'][$key], 0, 5);
			$dirmail = "c:/wamp/www/portal/documentacao/";
			$dir = '../documentacao/';
			$nomedocumento_ = date("Ymd") . date("His") . "-";
			ficheiros ="$dir". $_FILES['ficheiro_']['name'][$key];
			$mime->addAttachment($dirmail . $nomedocumento_ . $_FILES['ficheiro_']['name'][$key]);
}
	$mime->setTXTBody($text);
	$mime->setHTMLBody($html); 

	$body = $mime->get(); 
	$hdrs = $mime->headers($hdrs); 

	$recipients = $to.", ".$cc . ", ". $bcc_;

	$mail =& Mail::factory("smtp"); 
	$mail->send($recipients , $hdrs, $body);

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.