$postid = $_GET['emailid'];
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
display_form($postid);
}
else {
email_post($postid, $_POST['from'], $_POST['to']);
}
function display_form($id) {
$script = the_permalink();
$html = <<<_HTML_
$script
_HTML_;
echo $html;
}
function email_post($id, $from, $to) {
require_once(‘/var/www/erictruett/object_sandbox/phpmailer/gmailer.class.php’);
$Mailer = new GmailMailer($debug=1);
$Mailer->Username = ‘eric.truett@gmail.com’;
$Mailer->Password = ‘cft0911′;
$Mailer->FromName = $from;
$Mailer->AddAddress($to);
$Mailer->Subject = ‘Indieball.com – new music for a new day’;
$Mailer->Body = $nm . ” wants you to visit http://www.indieball.com?p=” . $id;
if ( !$Mailer->send_email() ) {
trigger_error(‘drats! It failed’, E_USER_WARNING);
}
else {
$Mailer->print_d(‘Message successfully sent!’);
$Mailer->print_d(“
Subject:{$Mailer->Subject}\n{$Mailer->Body}
“);
echo “
Return to indieball
“;
}
}
?>