Forgot Password / Register
Site Statistics
Total Members: 520
Total Tutorials: 242
Newsest User: 8884244477
Todays Unique Hits: 353
0 Users 7 Guests Online
Forum Index » PHP + MySQL » News mailing list
Posted on Wednesday 8th August 2007 at 10:16 PM
dtnet
templates/default/images/noavatar.png's Avatar
Active Member
A friend of mine need a news mailing list-sript that does this:

E.g.

I'm writing my e-mail adress in a form and press submit, and then the administrator gets my e-mail adress, so he can add me to a news mailing list.


Sorry for my bad language, but didn't know the english word for what I ment ;)
Posted on Wednesday 8th August 2007 at 11:16 PM
Diablosblizz
templates/default/images/noavatar.png's Avatar
Senior Member
Haha, simple.

PHP Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
switch ($_GET[page]) {

default:
echo 
"<form action='?page=mail' method='post'>
Your email address: <input type='text' name='email'><BR>
<input type='submit' value='Submit'>
</form>"
;
break;

case 
'mail':

$email $_POST[email];

if(!
$email) {
echo 
"You need to enter in your email address!";
} else {

$subject "Message from a user.";
$from "$email";
$body "$email would like you to add them to the mailing list!";
$to "YOUREMAILADDRESSHERE@DOMAIN.COM";

mail($to$subject$body"From: $email");

if(
mail) {
echo 
"Message sent.";
} else {
Echo 
"Error, please try again.";
}
break;
}
?>


Should work, if it doesn't then tell me and I'll attempt to fix.
Posted on Saturday 11th August 2007 at 10:36 PM
dtnet
templates/default/images/noavatar.png's Avatar
Active Member
Didn't work. I think he didn't got any e-mail.