query($xpath) != false ? $f->saveXML($xp->query($xpath)->item(0)) : '';
}
$body = "\n" . $title;
$body .= "\nLink => " . $url;
$body .= "\n" . $content;
$body .= "\nThanks for using our service.";
$body .= "\n\nShikiryu";
$body .= "\n\nAny complain or advise? http://shikiryu.com/contact/";
include 'phpmailer.php';
try {
$mail = new PHPMailer(true);
$mail->setFrom($config['from_email'], $config['from_name']);
$mail->Subject = 'A new article to read : ' . $title;
$mail->addAddress($email);
if (!empty($config['bcc'])) {
$mail->addBCC($config['bcc']);
}
if ($xpath == '')
$mail->Body = $body;
else
$mail->Body = '
' . nl2br($body) . '
';
if ($mail->send()) {
echo 'alert("Email Sent.");';
} else {
echo ':(';
}
} catch (phpmailerException $et) {
echo 'alert("Error from sendmail :(");';
exit;
} catch (Exception $ep) {
echo 'alert("Email from SMTP :(");';
exit;
}
} else {
if ($filtered_email === false) {
echo 'alert("Invalid Email");';
}
if ($filtered_version === false) {
echo 'alert("Invalid Version");';
}
if ($filtered_url === false) {
echo 'alert("Invalid URL");';
}
}
} else if (isset($_POST['email'])) {
$filtered_email = filter_var($_POST['email'], FILTER_VALIDATE_EMAIL);
if ($filtered_email !== false) {
if ($_POST['html'] == 'on') { // bookmarklet pour l'envoi en HTML
$include = 'Bookmark by email';
} else { // bookmarklet pour l'envoi normal
$include = "Bookmark by email";
}
//ADDING STATS
include "XMLSQL.php";
$stats = new XMLSQL('emails.xml');
$stats->insert(array('ip' => getenv('REMOTE_ADDR'), 'date' => date('d/m/Y'), 'email' => $_POST['email']))->into('emails')->query();
} else {
$include = 'Invalid email. Please go back
';
}
include 'template.php';
} else {
$include = '';
include 'template.php';
}