Dear Coder(s).
Hi There, I am currently developing a Membership System to give me some more insights into the PHP and mySQL language. Please can a coder(s) help me do what I need to do, detail in Red Text.
What I have so far:
Member Register Form (Complete)
Member Login Form (Complete)
Member Change eMail Address / Profile / Password Form(s) (Complete)
Member Logout (Complete)
Admin Login (Complete)
Admin See Registered Users (Complete)
Admin Change Member Details - eMail Address / Password (Complete)
Admin Logout (Complete)
What I need help to do:
Admin Mass eMail Members (getting email address from mySQL table)
Above in Red is what i need help to do.
Many Thanks,
Best Regards, Gavin.
Comments
2. Is it OK to lump the users together in a cc or bcc list? Or do you require 1 email per recipient?
Why not just get some free mailing list scripts from one of the script sites?
1) Subject
2) Message
then when i press 'Submit' it connects to mySQL DB, retrieves the email address(s) then emails the members.
.Gavin
My question is regarding how you want the email to be sent out:
1. One email per recipient or
2. Multiple recipients in a single email. If this method is OK, and you do not want the recipients to be aware of the other recipients, bcc can be used.
In your html form, use:
<form action="mailapp.php" method="post>
name the content field as "message"
name the subject field as "subject"
Assumptions:
1. Database Type = MySQL
2. Database Host = "MyHost"
3. Database Name = "MyDB"
4. Database User = "MyUsr"
5. Database User Password = "MyPwd"
6. Table containing email addresses = "TBL_EMAIL"
7. TBL_EMAIL only contains 1 field = "COL_ADDRESS"
In your mailapp.php, enter the following:
<html>
<body>
<form name="subject" method="post" action="">
<input type="text" name="textfield">
</form>
<form name="message" method="post" action="">
<textarea name="textarea"></textarea>
</form>
<form action="mass.php" method="post">
<input type="submit" name="Submit" value="eMail Members">
</form>
</body>
</html>
Thats the forum that will take the info for the email...
[php]
<?
$sqldb = "yourdb";
$sqluser = "youruser";
$sqlpass = "yourpass";
$sqlhost = "localhost";
$conn = mysql_connect("$sqlhost","$sqluser","$sqlpass");
$sdb = mysql_select_db("$sqldb");
$query = "SELECT * FROM tablewithemails";
$result = mysql_query($query);
while($row = mysql_fetch_assoc($result)){
$member_name = $row[username];
$member_email = $row[user_email];
$message .= "\n\rThank you $member_name";
mail($member_email, $subject, $message)
}
?>
[/php]
I didnt have time to make it fancy. but that should work. Cheers..
Gavin, you've gotten your html all wrong. Anyway, Forge's html code should sort yours out.
What format? The HTML page format?
Try this for your html page:
Note that:
1. The name of the edit field ("subject") must match the $subject variable in your PHP file
2. The name of the text area field ("message") must match the $message variable in your PHP file
3. You need to name your PHP file as "mass.php" if you use "mass.php" in the form action
1) how do i do a return message saying something like 'email(s) sent'
2) how do i put the site name as the sender?
-Gavin
Link: http://www.mach5.com/
http://www.thekey.it