View file pofhq-wapmail/sendmail.php

File size: 1.47Kb
<?
/*
$Header: /home/cvsroot/pofhq-wapmail/sendmail.php,v 1.4 2002/12/12 21:44:33 pau Exp $
Copyright (c) 2002 Pau Oliva Fora <[email protected]>               
Licensed under the GNU GPL. For full terms see the file COPYING.
*/

require("config.php");
wmlheader();
wmlmeta();

/* try to "authenticate" the user with imap: if he's not a valid imap user we don't let him send e-mails */
$mbox = imap_open ("\{$IMAPSERVER:$IMAPPORT}$F", "$U", "$P",OP_HALFOPEN) or wmldie ("can't connect: " . imap_last_error());
imap_close($mbox);

$headers = "From: <$From>\n";
$headers .= "X-Sender: <$U@$DOMAIN>\n";
$headers .= "X-Originating-IP: [$REMOTE_ADDR]\n";
$headers .= "X-Mailer: pofHQ wapMAIL $VERSION\n";

$Body = "$Body

____________________________________________
This e-mail was sent using pofHQ wapMAIL $VERSION
from a $HTTP_USER_AGENT browser.
";

/* verify if "To" and "From" have a valid e-mail address format */
if (!ereg("^([0-9,a-z,A-Z]+)([.,_]([0-9,a-z,A-Z]+))*[@]([0-9,a-z,A-Z]+)([.,_,-]([0-9,a-z,A-Z]+))*[.]([0-9,a-z,A-Z]){2}([0-9,a-z,A-Z])?$", $To )) wmldie("$S_TO $To");
if (!ereg("^([0-9,a-z,A-Z]+)([.,_]([0-9,a-z,A-Z]+))*[@]([0-9,a-z,A-Z]+)([.,_,-]([0-9,a-z,A-Z]+))*[.]([0-9,a-z,A-Z]){2}([0-9,a-z,A-Z])?$", $From )) wmldie("$S_FROM $From");

mail($To, $Subject, $Body, $headers);

echo "<card><p>$S_SENDOK $To<br/><br/>\n";
waplink($S_SUBMIT,$S_SENDOTHER,"compose.php",array("F"=>$F,"U"=>$U,"P"=>$P));
wapbutton(0,$S_INDEX,"index.php",array("F"=>$F,"U"=>$U,"P"=>$P));
echo "</p>\n";

wmlfooter();
?>