help with mail():PHP
Posted: Tue Jun 21, 2005 4:40 pm
Hi, I am trying to send mail using the mail() function and I am not able to do it. I suspect that I havenot mentioned the SMTP address. The SMTP address is "mail.allhyper.com". I dont know where to give this information within the php code.
The actual running file can be found at: http://raghavan.allhyper.com/sendMail.php
I would appreciate help regarding the issue.
The actual running file can be found at: http://raghavan.allhyper.com/sendMail.php
I would appreciate help regarding the issue.
Raghavan<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Send Mail</title>
<link href="cms.css" rel="stylesheet" type="text/css" />
</head>
<body>
<center>
<table width = '600' cellspacing = '1' class = 'bordersOnly' style = 'margin-top:5px'>
<form name="frmMail" method="post" action="">
<tr class = 'commonHeader'><td colspan="2" class="Calign">Send Mail</td></tr>
<tr><td width="120" class="Ralign">To:</td><td><input type="text" name="txtTo" value="<? echo $_GET["recipient"] ?>" size="65"></td></tr>
<tr><td width="120" class="Ralign">Subject:</td><td><input type="text" name="txtSubject" value="" size="65"></td></tr>
<tr><td width="120"class="Ralign">Message:</td><td><textarea name="txtMessage" rows="15" cols="50"></textarea></td></tr>
<tr><td></td><td><input type="submit" name="subMail" value="Send Mail"></td></tr>
</form>
</table>
</center>
</body>
</html>
<?
if ($_POST["subMail"] == "Send Mail") {
// to
$to = $_POST["txtTo"];
//the subject
$subject = $_POST["txtSubject"];
// the message
$message = $_POST["txtMessage"];
$message = wordwrap($message, 70);
// Send
echo mail($to, $subject, $message);
}
?>