Results 1 to 7 of 7
Thread: how to send newsletter in HTML?
-
04-18-2005, 10:54 AM #1Aspiring Evangelist
- Join Date
- Jan 2005
- Location
- WHT, where else?
- Posts
- 420
how to send newsletter in HTML?
Hi,
I am wondering how I can send newsletter to my registered users in HTML (not the plain text).
is there any softwares that I can use?
thanks█ Tubenode.com - FFMPEG, PHP & RoR Hosting
█ RCholic.com - R/C videos sharing
-
04-18-2005, 02:46 PM #2rogue element
- Join Date
- Jun 2004
- Location
- Northwest Colorado
- Posts
- 4,636
I think you're making this too hard -- if you want to send someone an HTML e-mail, author the e-mail in HTML and send it to them.
I strongly suggest an option for your users, many folks don't like having HTML e-mail 'inflicted' on them.Eric J. Bowman, principal
Bison Systems Corporation coming soon: a new sig!
I'm just a poor, unfrozen caveman Webmaster. Your new 'standards' frighten, and confuse me...
-
04-18-2005, 04:17 PM #3WHT Addict
- Join Date
- Apr 2004
- Location
- USA
- Posts
- 146
try World Cast, there is a free version for it.
-
04-21-2005, 09:28 AM #4Aspiring Evangelist
- Join Date
- Aug 2004
- Posts
- 351
Hello,
Since the PHP scripts should be rather simple, therefore I develop by myself. I think the script is not perfect. However it works perfectly. I use this to send monthly notice to members. Here's the script:
1. HTML Form
<html>
<head>
</head>
<body>
<Center><h3>Send Newsletter to All Members</h3></center>
<form action="send.php" method="post">
<table align=center border=2 WIDTH=95% cellspacing=0 cellpadding=5>
<TR><TD bgcolor="#99FF99">
<table align=center border=0 WIDTH=100% cellspacing=0 cellpadding=3>
<tr>
<td valign=top>
<input type=radio name="member_group" value="all" checked>All Members<br>
<input type=radio name="member_group" value="server_1">Server_1 <br>
<input type=radio name="member_group" value="server_2">Server_2 <br>
<input type=radio name="member_group" value="server_3">Server_3 <p>
</td>
</tr>
<tr>
<td valign=top>Subject: </td>
</tr>
<tr>
<td><input type=text name="subject" size=60></td>
</tr>
<tr>
<td valign=top>Message: (Dear $Real_Name will auto insert) </td>
</tr>
<tr>
<td><textarea name="message" rows=20 cols=60></textarea></td>
</tr>
<tr>
<td><input type=submit name=submit value=submit></td>
</tr>
</table>
</TD></TR>
</table>
</form>
</body>
</html>
2. send.php PHP script
<?
// create connection
$connection = mysql_connect("localhost", "user_name", "password") or die ("Couldn't connect to the server.");
// select database
$db = mysql_select_db("database_name", $connection) or die ("Couldn't select database.");
// create SQL
if ($member_group == "all") {
$sql = "SELECT email, real_name FROM member_table";
}
else if ($member_group == "server_1") {
$sql = "SELECT username FROM table_name where server ='server_1'";
}
else if ($member_group == "server_2") {
$sql = "SELECT username FROM table_name where server ='server_2'";
}
else if ($member_group == "server_3") {
$sql = "SELECT username FROM table_name where server ='server_3'";
}
// execute SQL query and get result
$result = mysql_query($sql, $connection) or die ("Couldn't execute query.");
//data from the message.php page
$subject = $_POST['subject'];
$message = $_POST['message'];
// set initial number to zero
$number_of_email = 0;
//Send message loop
if ($member_group == "all") {
While ($row = mysql_fetch_array($result)) {
$real_name = $row['real_name'];
$email = $row['email'];
//Take notice that we've included $subject and $message below
mail("$email","$subject","Dear $real_name\n\n$message","From: admin@YourDomain.com");
$number_of_email = $number_of_email + 1;
echo "$real_name $email<br>";
}
}
else if ( ($member_group == "server_1") || ($member_group == "server_2") || ($member_group == "server_3") ) {
While ($row = mysql_fetch_array($result)) {
$username = $row['username'];
// create SQL_2 from member table
$sql_2 = "SELECT email, real_name FROM member_table where username = '$username'";
// execute SQL query and get result
$result_2 = mysql_query($sql_2, $connection) or die ("Couldn't execute query.");
//Send message loop
While ($row_2 = mysql_fetch_array($result_2)) {
$email = $row_2['email'];
$real_name = $row_2['real_name'];
//Take notice that we've included $subject and $message below
mail("$email","$subject","Dear $real_name\n\n$message","From: admin@YourDomain.com");
$number_of_email = $number_of_email + 1;
echo "$real_name $email<br>";
}
}
}
echo("Total $number_of_email emails sent!<br>");
//Close the database connection
mysql_close();
?>
-
04-23-2005, 09:20 AM #5Web Hosting Master
- Join Date
- Sep 2004
- Posts
- 1,475
Originally posted by BigBison
I think you're making this too hard -- if you want to send someone an HTML e-mail, author the e-mail in HTML and send it to them.
I strongly suggest an option for your users, many folks don't like having HTML e-mail 'inflicted' on them.
HTML e-mail? What kind of "inflict"? Thanks!
-
04-23-2005, 10:45 AM #6rogue element
- Join Date
- Jun 2004
- Location
- Northwest Colorado
- Posts
- 4,636
Yes, that's what I meant. Not everyone likes receiving HTML e-mail. Some people really despise it. Where they sign up for the newsletter, give a checkbox for html. It can be checked by default, just give an option for people who think e-mail should just be text and don't want to download a bunch of images with it.
-
04-23-2005, 10:49 AM #7Web Hosting Master
- Join Date
- Mar 2003
- Posts
- 830
Yes, indeed, many prefer plain text and no html. Users should have an option.