Jag vill kunna skicka en sida som mejl, sidan heter mail.php?uid=3245, hur gör jag detta?
skicka mejl
3 svar · 227 visningar · startad av benken
kolla upp funktionen mail() i manualen
Kolla här,
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$mailheaders = "From: Henrik<> \n";
$mailheaders .= "Reply-To: [email]Henrik@geekplanet.net[/email]\n\n";
mail("h@mail.kom", "Hej!", $här vill jag ha in mail.php exekverad, $mailheaders) or die("Fel...");
Hur görs det?
<?
// funktion hämtad från kommentar i manualen
function evalHTML ( $string ) {
$pos = 0;
$start = 0;
/* Loop through to find the php code in html... */
while ( ($pos = strpos( $string, '<?php', $start )) != FALSE ) {
/* Find the end of the php code.. */
$pos2 = strpos( $string, "?>", $pos + 5);
/* Eval outputs directly to the buffer. Catch / Clean it */
ob_start();
eval( substr( $string, $pos + 5, $pos2 - $pos - 5) );
$value = ob_get_contents();
ob_end_clean();
/* Grab that chunk! */
$start = $pos + strlen($value);
$string = substr( $string, 0, $pos ) . $value . substr( $string,
$pos2 + 2);
}
return $string;
}
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$mailheaders = "From: Henrik<> \n";
$mailheaders .= "Reply-To: [email]Henrik@geekplanet.net[/email]\n\n";
$innehall=implode ('', file ('http://x.se/mail.php?uid=3245'));
$filen=evalHTML($innehall);
mail("h@mail.kom", "Hej!", $filen, $mailheaders) or die("Fel...");
?>