hier mal ein konkretes Code-bsp.:
Code:
<?php
//php beginn
// die von tele erwähnten Post-variablen...
$mail_receiver = $HTTP_POST_VARS['mail_receiver'];
$mail_input = $HTTP_POST_VARS['mail_input'];
$mailing = $HTTP_POST_VARS['sendmail'];
$sendmail = $HTTP_POST_VARS['sendmail'];
// springe aus php
?>
<html>
<head>
<title> Mailing in php </title>
</head>
<body>
<table width=100%>
<?php
// php beginnt...
// Funktion zum Einlesen der Daten...
function mailInput()
{
global $mail_receiver,$fn_user;
//voreingestellte Mailempfänger ...
$mail_receiver= "xxx@yyy.de, xxxx@web.de";
// der eigentliche text
$body = "Für xxxxx\n";
$body .= ".....\n\n";
$body .= "Datum: ".date("d.m.Y, H:i:s")." Uhr\n";
?>
<form action="<?echo $SELFNAME ?>" method="post" align="center">
<table>
<tr>
<td>
<input type="text" size="70" maxsize="70"
name="mail_receiver" class="input"
value="<?echo $mail_receiver ?>">
</td>
</tr>
<tr>
<td>
<textarea cols="150" rows="9"
name="mail_input"><?echo $body ?>
</textarea>
</td>
</tr>
<tr>
<td>
<input type="Submit" value="Mail schicken ..."
name="sendmail" class="button">
</td>
</tr>
</table>
</form>
<?php
}
// die Funktion die die Daten von der mailInput-Funktion nimmt und die Mail schickt
function sendMail()
{
global $mail_receiver,$mail_input;
echo 'Mail wurde an '.$mail_receiver.' verschickt...<br><br>';
// subject kann auch noch in eine Form ausgelagert werden...
$subject = "MAIL";
@mail($mail_receiver, $subject, $mail_input, "From: $mail_receiver");
}
if (isset($mail_receiver) && isset($mail_input))
{
// wenn link geklingt mit der GET-Variablen...
if ($_GET['action']=='mail')
{
mailInput(); // Eingabe der Daten für die Mail
}
else
if(isset($sendmail))
{
sendmail(); //eigentliche Mail schicken
}
}
else
{
echo "STARTSEITE...";
echo "<a href=\"$SELFNAME?action=mail<b>Mail schicken ...</b></a>";
}
?>
</table>
</body>
</html> müsste eigentlich gehen..