emailing sav files, wont work?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Pezmc
Forum Commoner
Posts: 53
Joined: Mon Nov 06, 2006 2:15 pm

emailing sav files, wont work?

Post by Pezmc »

Mailing sav files wont work but when I change the extension of the file to .txt it does work.

See Below Script:

Code: Select all

//Attachment version of message
			$extension=explode (".", file.sav); 
			$countdot=count($extension)-1;
			$extension=$extension[$countdot];
			$headers .= "--{$boundary}\r\n" .
				"Content-Type: application/octet-stream\r\n" .
				"Content-Transfer-Encoding: base64\r\n" .
				"Content-Disposition: attachment; filename="file.sav"\r\n";
			$headers .= chunk_split(base64_encode(file_get_contents('backup/file.sav)));
			$headers .= "\r\n --{$boundary}--";
	}
		
	if (!mail("geoff@googlemail.com", "Test", "", $headers)) { 
		$erreur++; $erreurmsg.='There was a problem sending your email please try again.<br>'; 
	}
(As part of bigger script that deals with all the headers etc...)


The above script sends a email to the email address, I can pick it up. Gmail shows the clip logo (attachment), but when I view the actual email no attached files are shown. However if I change this line:

Code: Select all

"Content-Disposition: attachment; filename="file.sav"\r\n";
to this:

Code: Select all

"Content-Disposition: attachment; filename="file.txt"\r\n";
the entire script works and I recieve the file but as a txt.

Does anyone have any idea how I can get sav files to be mailed. I have tried sending them using gmail (it works fine) and reading the mime but it is exactly the same as mine.

Please tell me whats wrong!
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Is there a reason you aren't using a mailing library instead of trying to do this yourself?
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

Post Reply