PHP Newsletter

Join now and receive weekly updates pertianing to the world of PHP.

Polls

What do you think about the new PHPMine Design?
Awesome
Not Bad
Sucks

PHP Gigs By City

PHP Jobs By Topic

Advertisements

Need help with using the PHP mail() funtion!!!?

Asked 2006-03-16 09:58:04 by bradmb15

Ok, I want to know how to be able to make it that people can subscribe to my website for when the new version comes out. Here's what I have so far:

<?php
if (isset($email_address) )
{
$to = 'email@example.com';
$subject = 'Please notify me when version 3.0 is released!';
$message = 'Email address: $email_address';
$headers = 'From: $email_address' . "\r\n" . 'Reply-To: email_address' ."\r\n" . 'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);

}
?>


<strong>Want to be notified when version 3.0 will be
released?
<form method="get" action="<?php $PHP_SELF ?>">
<input type="text" name="email_address" value="Enter you email here" style="font-family: Arial, serif; color: black;">

<input type="submit" value="Submit" style="font-family: Arial, serif; color: black; font-weight: bold">
</form></strong>

I can't get it to work...can anyone please helo me??
Hmm...I tried that but it didn't seem to work...
I figuered out a new way by myself...

Anwered 2006-03-28 05:17:23 by B1t Hunt3r

A good tips from a programmer try PHP manual, i find it very helpful when i want to know something and don't jump over the comments if they are avilable...

Anwered 2006-03-16 12:22:40 by i_hates_spam

Try this:

<?
if(isset($submit)) {
$to = "email@example.com";
$from = "From: ".$email;
$subject = "Please notify me when version 3.0 is released!";
$body = "Email address: $email";

if(mail($to, $subject, $body, $from)) {
echo "<p><strong>Thanks! We'll notify you when the changes go online!</p>\n";
}
else {
echo "<p><strong>Sorry, we couldn't add you to the list.</strong> We apologize for this problem.</p>\n";
}
}
else {
?>
<form id="notify" name="notify" method="post">
<input name="email" type="text" id="email" value="Enter your email here" />
<input name="submit" type="submit" id="submit" value="Submit" />
</form>
<?
}
?>

Questions and answers provided by the Yahoo Answers Community.