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
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);

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.