Forum Moderators: coopster

Message Too Old, No Replies

PHP mailing list - I'm a musician not a web developer!

php mailing list

         

Mr Winstanley

11:56 am on May 6, 2006 (gmt 0)

10+ Year Member



Hi, trying to get this mailing list working for our band website. As I'm a poor musician, I've learned to do this myself but can't quite get it working.

As a user, when you submit your details it says 'thanks, you've been added to the list etc..', but I don't actually recieve an email telling me their details so I can add them to my list. I'm not using a database or anything just making my own list of the names.

When I first put it up it worked fine, but all of a sudden it just stopped, and I hadn't changed anything.

HELP PLEASE!

THIS IS MY PHP

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<html>
<head>
<title>Official Homepage</title>
</head>
<body>
<?php

$potential_member_name = $_POST['name'];
$potential_member_email = $_POST['email'];

$email_subject = 'New mailing list subscriber';

$email_body = 'this fellow or perhaps fine young lady wants to hear more from us';
$email_body .= "name is $potential_member_name";
$email_body .= "email is $potential_member_email";

$from_name = 'Winters Web Lord';
$from_email = 'webmaster@example.com';

$headers = "from: $from_name <$from_email>\r\n";
$headers .= "reply-to: $from_name <$from_email>\r\n";
$headers .= "return-path: $from_name <$from_email>\r\n";
$headers .= "content-type: text/plain; charset=iso-8859-1\r\n";
$headers .= "x-priority: 1\r\n";
$headers .= "x-msmail-priority: normal\r\n";
$headers .= "x-mailer: php\r\n";

$to_email = 'mail@example.com';

mail($to_email, $email_subject, $email_body, $headers);

echo "<p>Thankyou $potential_member_name, your email address
($potential_member_email) has been added to our list. You shall hear from us
soon!</p>";

?>

</body>
</html>

AND THIS IS THE LITTLE FORM IT SITS IN

<div id="form">
<img src="joinmail.jpg" alt="Join the mailing list!"/>
<form action="thanks.php" method="post" >
<p>Name : <input type="text" name="name" size='30' value='' maxlength='60'/></p>
<p>Email : <input type="text" name="email" size='30' value='' maxlength='60'/></p>
<p><input type="submit" value="submit" name="submit"/></p>
</form>
</div>

THANKS EVERYONE!

[edited by: encyclo at 11:58 am (utc) on May 6, 2006]
[edit reason] examplified [/edit]

dreamcatcher

6:06 pm on May 6, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi Mr Winstanley, welcome to Webmaster World. :)

You say it was working originally? So, maybe its a server issue? I can`t see any reason for the mail not to send. Unless of course you are really using 'mail@example.com' as your address ;)

Has your hosting company made any changes? Does the PHP mail function work in other things you have done. Try just echoing the mail function on a single page to see if the mail gets sent as a test:

<?php

mail('you@yoursite.com','Test','Test', 'From:<you@yoursite.com');

echo 'Sent';

?>

dc