Thanks for your reply gesf, I tried your suggestion but the mail arrives as displayed by outlook.
I think the problem is that the file is passed to outlook the form variables are unknown.
The following demonstates the problem (save as 'thisfile.php'). The script has 3 states:
input, display, print , if you try to email from ie (menu file/send/page as email) in any
state, the 'input state' part will always be displayed in the email body.
- Code: Select all
<html>
<head>
<title>Send by email from internet explorer</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
$state = 'input'; // default state
if (isset($_POST['InputBtn']) && $_POST['InputBtn'] == "Input")
$state = 'input';
if (isset($_POST['DisplayBtn']) && $_POST['DisplayBtn'] == "Display")
$state = 'display';
if (isset($_POST['PrintBtn']) && $_POST['PrintBtn'] == "Print")
$state = 'print';
?>
<form action="thisfile.php" method="post">
<?php
switch ($state) {
case 'input':
echo "<p>Please enter some text:</p>"; ?>
<input type="text" name="someinput" ><br><br>
<input name="DisplayBtn" type="submit" value="Display">
<input name="PrintBtn" type="submit" value="Print"
onclick="this.form.target='_preview';window.open('',this.form.target,'dependent=no,toolbar=1,directories=0,location=0,status=1,menubar=1,scrollbars=1,resizable=1,width=700,height=400').focus();">
<?php break;
case 'display':
echo "<p> You entered: ".$_POST['someinput']."</p>";
echo "<p> Click 'Print' for a printable version </p>"; ?>
<input name="someinput" type="hidden" value="<?php echo $_POST['someinput']; ?>">
<input name="InputBtn" type="submit" value="Input">
<input name="PrintBtn" type="submit" value="Print"
onclick="this.form.target='_preview';window.open('',this.form.target,'dependent=no,toolbar=1,directories=0,location=0,status=1,menubar=1,scrollbars=1,resizable=1,width=700,height=400').focus();">
<?php break;
case 'print':
echo "<p> This is the printable version, displayed in a new window, with no buttons or input boxes</p>";
echo "<p> You entered: ".$_POST['someinput']."</p><br>";
echo "<p> Click <b>'File / Send / Page by E-mail..'</b> to send this page as email.</p>"; ?>
<?php break;
} // end switch
?>
</form>
</body>
</html>
By the way, to create a new window from the onclick print button, the target is set to '_preview' in the above, does anyone know how '_preview' differs from '_blank' ?