Posts: 159
Location: Skegness, Lincolnshire, England
|
Hmmmmmmmmm ... not sure how to do this using your mail client as I have always used scripts to mail HTML emails as this enables me to set the mime type correctly so that the HTML is viewed and not simply seen as text. Below is a very simple mailing page using PHP:
PHP Code:
<?php
$to = $_POST['to'];
if (!$to) { $to = 0; }
// read in the newsletter - edit the filename to suit
$fname = "your_newsletter.html";
$handle = fopen($fname, "rb");
if (flock($handle, LOCK_EX)) {
$mess = file_get_contents($fname);
flock($handle, LOCK_UN);
}
fclose($handle);
// edit this line to give the subject
$subject = "This month's newsletter";
// edit this line to the email address you are mailing from
$from = "you@yourdomain.com";
if ($to != 0) {
// check the email address is valid
if (eregi ("^([a-z0-9_]|\\-|\\.)+@(([a-z0-9_]|\\-)+\\.)+[a-z]{2,4}$", $to)) {
// if email address is valid, mail the newsletter
$headers = "MIME-Version: 1.0\n";
$headers .= "Content-Type: text/html; charset=iso-8859-1 \n";
$headers .= "To: $to <$to>\n";
$headers .= "From: $from <$from>\n";
mail("", $subject, $mess, $headers);
}
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<body>
<?php
if (!eregi ("^([a-z0-9_]|\\-|\\.)+@(([a-z0-9_]|\\-)+\\.)+[a-z]{2,4}$", $to)) {
echo "<span style='color:red'>The email address you entered did not conform to recognised standards.</span>";
}
?>
<form action="send.php" method="post" name="send" id="send">
Email: <input type="text" name="to"> <input type="submit" value="Send">
</form>
</body>
</html>
This is very basic and would mean that you would have to manually edit a couple of lines each month, but it does at least check that the email address you have entered is correct. Name the page send.php and upload it into an area of your site you have as an admin area, or is secure from other people, then all you have to do is manually enter the email address and click on Send and your email will be delivered in HTML!
This is based on a script I wrote for my ecards site that sends the entire ecard to the inbox, and not just a link.
|