Location: PHPKode > projects > FeedMeLinks, Social BookmarkingSince2002 > testing/linkpocket-sender.php
<%
	include_once( "../modules/utils.inc.php" );

	function get_linkpocket_dl_command( $arg_mode, $arg_folder_id ) {
		if( $arg_folder_id && ($arg_mode == "dump" || $arg_mode == "source" )) {
			return "/usr/local/bin/lynx -accept_all_cookies --$arg_mode \"http://feedmelinks.com/folder?folder="
				. $arg_folder_id . "&condensed=1&_internal=1\""
				. "| sed 's/^ *//'";
		}
	}

	# josh at sdfahrenheit dot com 15-Apr-2004 05:52 For anyone having
	# problems with attached files coming through garbled, make sure you
	# have magic_quotes_runtime set to Off in your php.ini - it adds
	# funky escape chars to your attached data and garbles the attachment.
	# 
	# This was giving me all kinds of grief.

	$lp_info = get_linkpocket( $u );
	$folder_id = $lp_info["id"];
	$num_lnks = $lp_info["count"];

	$msg = "From: Feed Me Links <hide@address.com>\n";
	$msg .= "MIME-Version: 1.0\n";
	$boundary = uniqid("FML_UNIQ_BOUNDARY");
	# advertise that we rock mime/multipart
	$msg .= "Content-Type: multipart/alternative; boundary = $boundary\n\n";

	# message f0r clients who dont understand MIME
	$msg .= "This is a MIME encoded message.\n\n";

	# plaintext message
	$msg .= "--$boundary\n" 
		. "Content-Type: text/plain; charset=ISO-8859-1\n"
		. "Content-Transfer-Encoding: 8bit\n\n";
	$msg .= shell_exec( get_linkpocket_dl_command( "dump", $folder_id ));

	# HTML message
	$msg .= "--$boundary\n" 
		. "Content-Type: text/html; charset=ISO-8859-1\n"
		. "Content-Transfer-Encoding: 8bit\n\n";
	$html = shell_exec( get_linkpocket_dl_command( "source", $folder_id ) );

	$msg .= $html; 

	# send the actual message
	$retVal = mail( "hide@address.com", "Your weekly linkpocket - $num_lnks links", "", $msg );
%>
retVal: <%= $retVal %>

<form>
	<textarea rows="49" cols="100"><%= $msg %></textarea>
</form>

Return current item: FeedMeLinks, Social BookmarkingSince2002