Need some help here to set priority of the mail to High

the mail() function

Moderators: macek, egami, gesf

sriram
New php-forum User
New php-forum User
Posts: 4
Joined: Thu May 13, 2004 12:31 pm

Need some help here to set priority of the mail to High

Postby sriram » Thu Nov 18, 2004 5:19 am

Below is a script which is hand coded for my college website.
What it does is, it mails the registration numbers in the dropdown list.Each registration number has different domain like .com,.net etc.

Now what i want is to set the MAIL PRIORITY TO HIGH
and i want to whole body of the message to go as SUBJECT instead of body itself.And blank or a full stop in the message body.

How do i do this...?I'm a learner in php and i want it for my coll.Please help me.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>

<?php

$this_file = $_SERVER['PHP_SELF'];

switch ($_GET['id'])
{

# Firstly we find if the person has filled in the form and wants to send

case "postmail":

switch ($_POST['admin_number'])
{

# Depending on which Admission Number they chose, select the appropriate domain

case "4ni00": $domain = "college.com"; break;
case "4ni01": $domain = "college.net"; break;
case "4ni02": $domain = "college.edu"; break;
case "4ni03": $domain = "college.edu"; break;

}

# Gather all the information into handy variables

# Send the message to the admin number @ the selected domain

$to = $_POST['admin_number'] . $_POST['admin_number_2'] . "@" . $domain;

# Set the from e-mail as the sender name, sendername@college.com

$from = "From: \"" .$_POST['sender_name']. "\" <" .$_POST['sender_name']. "@college.com>";

# Store the subject in the subject variable

$subject = $_POST['subject'];

# Store the message in the message variable

$message = $_POST['message'];

# Check to see whether the message sent successfully

if (mail($to,$subject,$message,$from))

{

# If it did, tell the user it was sent and redirect them back to the form

echo "<center><font size=\"1\">";
echo "Your message has been sent to its destination<br>Please wait while you are re-directed to the main page.";
echo "<meta content=\"2; url=" .$_SERVER['PHP_SELF']. "\" http-equiv=\"refresh\">";
echo "</font></center>";

}
else
{

# If it failed, tell the user it failed and redirect them back to the form

echo "<center><font size=\"1\">";
echo "Your message has failed to send to its destination<br>Please wait while you are re-directed to the main page.";
echo "<meta content=\"2; url=" .$_SERVER['PHP_SELF']. "\" http-equiv=\"refresh\">";
echo "</font></center>";

}


break;

# If the user has not already filled in the form, present the form for them

default:
?>


<form name="form1" method="post" action="<?php echo $this_file . "?id=post" ?>">
Adminision Number:
<select name="admin_number">
<option value="4ni00">4NI00</option>
<option value="4ni01">4NI01</option>
<option value="4ni02">4NI02</option>
<option value="4ni03">4NI03</option>
</select>
<input name="admin_number_2" type="text" id="admin_no">
<br>
<br>
Sender Name:
<input name="sender_name" type="text" id="sender_name">
<br>
<br>
Subject:
<input name="subject" type="text" id="subject">
<br>
<br>
Message:<br>
<textarea name="message" cols="45" rows="7" id="message"></textarea>
<br>
<br>
<input type="submit" name="Submit" value="Send Message">
</form>

<?php break; } ?>

</body>
</html>

User avatar
ruturajv
php-forum Super User
php-forum Super User
Posts: 1280
Joined: Sat Mar 22, 2003 9:42 am
Location: Mumbai, India
Contact:

Postby ruturajv » Thu Nov 18, 2004 9:32 am

You need to know the MIME fundamentals..
anyways to do that make a header...
check mail function
check how do you add custom subject header , etc...

if you find that very difficult try this
PHPMailer

sriram
New php-forum User
New php-forum User
Posts: 4
Joined: Thu May 13, 2004 12:31 pm

Thanks pal...

Postby sriram » Fri Nov 19, 2004 8:37 am

Thanks pal.Hope it helps...
lets see.
thanks once again...


Return to “PHP coding => Mail”

Who is online

Users browsing this forum: No registered users and 1 guest

cron