HELP with code
Posted: Tue Jun 06, 2006 6:38 am
Can anyone help me:
I want to send an email and i have a 'sendmail.php' page with this code:
And in mail.php i have:
I only have the echo just to try. That is not working the echo $to and the others are.
I think its because the $to is in a variable and from, subject, message are in a input.
How can i do?
Thanks in advance
I want to send an email and i have a 'sendmail.php' page with this code:
Code: Select all
<form action="include/mail.php" method="POST" name="Mail Send" id="sendmail">
<?php
@$to = $_POST['to'];
@$from = $_POST['from'];
@$subject = $_POST['subject'];
@$message = $_POST['message'];
?>
$to = "";
$email[1] = "caselcoop@caselcoop.pt";
$email[2] = "webmaster@caselcoop.pt";
$email[3] = "marco@caselcoop.pt";
$email[4] = "carlos.coradinho@caselcoop.pt";
$email[5] = "anabela.fialho@caselcoop.pt";
$email[6] = "jorge.ramelhete@caselcoop.pt";
$email[7] = "alberto.ferreira@caselcoop.pt";
$email[8] = "anabela.prudencio@caselcoop.pt";
$email[9] = "dulce.lucas@caselcoop.pt";
$email[10] = "joao.traquina@caselcoop.pt";
$email[11] = "mcoelho123@hotmail.com";
$default_email = "caselcoop@caselcoop.pt"; // To choose default mail address if none chosen
$default_error = "Email Inválido"; // To display error msg if none chosen
$use_error_msg = 0;
$use_default_mail = 1;
// Choose one of the above methods to use
$email_address = $email[$send];
if($email_address == "" xor !isset($email_address) xor $send == "") {
if($use_error_msg == "1") {
$to = $default_error;
} else if($use_default_mail == "1") {
$to = $default_email;
}
// end if email address string is blank
} else {
$to = $email_address;
}
echo " " . $to;
?>
<input name="from" type="text" id="from" size="50" >
<input name="subject" type="text" id="subject" size="50">
<textarea name="message" cols="50" rows="10" id="message" type="text"></textarea>Code: Select all
<?php
/*
$to = $to2 . ", ";
$to .= "mcoelho123@hotmail.com";
*/
/*
$subject = $subject2;
$message = "<html><head><title>NET</title></head><body>" . nl2br($message2) . "</body></html>";
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Additional headers
$headers .= 'To: ' . $to . "\r\n";
$headers .= 'From: NET ' . '<' . $from2 . '>' . "\r\n";
// $headers .= 'Cc: ' . "\r\n";
// $headers .= 'Bcc: ' . "\r\n";
// mail($to, $subject, $message, $headers);
// header("Location: " . "../sendmail.php?msg=sent");
*/
echo "to: " . $to . "<br>";
echo "from: " . $from . "<br>";
echo "subject: " . $subject . "<br>";
echo "message: " . $message . "<br>";
?>I think its because the $to is in a variable and from, subject, message are in a input.
How can i do?
Thanks in advance
[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1 wrote:2. Use descriptive subjects when you start a new thread. Vague titles such as "Help!", "Why?" are misleading and keep you from receiving an answer to your question.