You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
postfixadmin/sendmail.php

46 lines
1.1 KiB
PHP

<?php
require "config.inc.php";
require "my_lib.php";
$sessid = check_session();
$sessid_domain = $sessid['domain'];
$sessid_username = $sessid['username'];
print_header("menu");
if (!empty($_POST['submit'])) {
$to = $_POST['to'];
if (empty($to)) print_error("You need to select an email address.");
$headers = "From: $sessid_username";
$subject = "Welcome";
$message = "Hi,\n\nWelcome to your new email account.\n\n";
if (!mail($to, $subject, $message, $headers)) {
print_error("Unable to send message to $to!");
}
print "Successfully send email to $to\n";
print "<p>\n";
}
?>
Send test message to a new mailbox.
<p>
<form name="mailbox" method="post">
<table class="form">
<tr><td>From:</td><td><?php print "$sessid_username"; ?></td></tr>
<tr><td>To:</td><td>
<select name="to">
<?php
$result = db_query("SELECT username FROM mailbox WHERE domain='$sessid_domain' ORDER BY domain");
while ($row = mysql_fetch_array ($result['result'])) {
print "<option>" . $row['username'] . "</option>";
}
?>
</select>
<tr><td colspan="2" align="center"><input type="submit" name="submit" value="Send Message"></td></tr>
</table>
</form>
<?php
print_footer();
?>