<%
$tmp_u = $u;
include_once( "../modules/utils.inc.php" );
function get_recent_peeps_dl_command( $arg_mode, $u ) {
if( $u && ($arg_mode == "dump" || $arg_mode == "source" )) {
return get_lynx() . " -accept_all_cookies --$arg_mode \"" . get_site() . "/contacts/big?_u=$u&_internal=1\""
. "| sed 's/^ *//'";
}
}
function send_peeps_email( $u ) {
$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_recent_peeps_dl_command( "dump", $u ));
# HTML message
$msg .= "--$boundary\n"
. "Content-Type: text/html; charset=ISO-8859-1\n"
. "Content-Transfer-Encoding: 8bit\n\n";
$html = shell_exec( get_recent_peeps_dl_command( "source", $u ) );
#$msg .= "get_recent_peeps_dl_command: " . get_recent_peeps_dl_command( "source", $u );
$msg .= $html;
# send the actual message
$recip = getEmailAddressForUser( $u );
$retVal = mail( $recip, "Your Peeps' Recent Links", "", $msg );
if( $retVal == 1 )
echo "successfully sent mail to $recip";
else
echo "NO MAIL sent to $recip";
%>
<!-- <form> <input type="submit" value="dummy"> <input type="text" name="dummy"> <textarea rows="49" cols="100"><%= $msg %></textarea> </form> -->
<%
}
send_peeps_email( $tmp_u ? $tmp_u : $u);
%>