Closed Thread Icon

Topic awaiting preservation: PHP email notification Pages that link to <a href="https://ozoneasylum.com/backlink?for=12644" title="Pages that link to Topic awaiting preservation: PHP email notification" rel="nofollow" >Topic awaiting preservation: PHP email notification\

 
Author Thread
shattered
Obsessive-Compulsive (I) Inmate

From:
Insane since: Feb 2003

posted posted 03-10-2003 05:50

Hi all,

Our group is doing a project on an internet radio with a dedication system. Anyone who dedicate a song in our website will receive an email notification that will consist of the song and message that they dedicated. This email notification would be sent out by the server automatically to the dedicator and dedicatee (people whom the dedicator dedicates the song to).

1.How do I tweak the codes so that it sends to both the sender AND the recipient?

Below is my code (taken from gurusnetwork.com):

code:
<?php
if (isset($submit)) {
if (!empty($name) and !empty($email) and !empty($recipientemail)){
if (mail ($recipientemail, $subject, "From: $name <$email>"))
$status = "<b><p>Thanks for your message, $name, it has been successfully
sent!</p></b>";
else
$status = '<p>Your message couldn\'t be sent! Please try again.
Thank you!</p>';
}
else
$status = "<b>Please fill the highlighted fields in red!</b>";
}
?>

<html>
<head>
<title>TITLE HERE</title>
<style type="text/css">
<!--
.error { font-weight: bold; color: red; }
-->
</style>
</head>
<body>

<?php
if(isset($status))
echo ($status);
?>

<form action="contact.php" method="post">

<p<?php
if (isset($submit) and empty($name))
echo(' class="error"');
?>>Your name:
<input type="text" name="name" value="<?php if(!empty($name))
echo($name); ?>" size="30"
/></p>

<p<?php
if (isset($submit) and empty($email))
echo(' class="error"');
?>>Your e-mail address:
<input type="text" name="email" value="<?php if(!empty($email))
echo($email); ?>" size="30"
/></p>


<p<?php
if (isset($submit) and empty($name1))
echo(' class="error"');
?>>Dedicatee name:
<input type="text" name="name1" value="<?php if(!empty($name1))
echo($name1); ?>" size="30" /></p>

<p<?php
if (isset($submit) and empty($recipientemail))
echo(' class="error"');
?>>Recipient email:
<input type="text" name="recipientemail" value="<?php
if(!empty($recipientemail))
echo($recipientemail); ?>" size="30" /></p>

<p>Your message:
<textarea name="message" cols="30" rows="5"></textarea></p>
<input type="submit" name="submit" value="Send" />
</form>
</body>
</html>



[This message has been edited by shattered (edited 03-10-2003).]

[This message has been edited by shattered (edited 03-10-2003).]

[This message has been edited by shattered (edited 03-10-2003).]

[This message has been edited by shattered (edited 03-10-2003).]

shattered
Obsessive-Compulsive (I) Inmate

From:
Insane since: Feb 2003

posted posted 03-10-2003 10:19

uhmmm..
that's ok guys..
i forgot that there's something called Cc *knocks on head*

trib
Paranoid (IV) Inmate

From: Den Haag, Netherlands
Insane since: Sep 2002

posted posted 03-10-2003 10:25

You seem to have missed your mail body out of your mail() function call, unless the subject IS the content perhaps ?? ... vis ...

if (mail($MailTo, $Subject, $Body, "From: $MailFrom")){

... so to send one to yourself too ...

code:
if (mail($MailTo, $Subject, $Body, "From: $MailFrom")){
// send one to me too
mail("my@email.address.edu", $Subject." copy of mail", $Body, "From: $MailFrom");
// then the rest of the processing .....
} else {
/// whatever
}



But really .. if you couldn't work that out for yourself, then you must be just blindly cut'n'pasting ... do ask yourself ... how are you going to maintain it? How areyou going to detect, and stop, a hacker using you as a relay for spam ?? ... should you be doing this ??



[This message has been edited by trib (edited 03-10-2003).]

« BackwardsOnwards »

Show Forum Drop Down Menu