php mail function issue.
| From: | vikas batra | Date: | Tue, 11 Dec 2007 05:50:35 +0000 |
| Subject: | php mail function issue. | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-28648@lists.php.net to get a copy of this message | ||
Hi,
I am trying to send mail using mail function of php, it's working fine on one server and it
fails to send mails on other server.On first server is showing message "Mail Sent
Successfully" and on other it is showing "Mail Sending Failed".In my local system it
is also working fine,this code was working fine some days ago but suddenly it stopped working,this
problem might be due to some server configuration changes, but i am not getting what exactly is the
issue , so that i can resolve it.what might be the reasons?Any body can explain me.......
<?php
if(isset($_REQUEST['send'])){
$to = $_POST['email'];
$subject = $_POST['subject'];
$message = $_POST['message'];
$headers = 'MIME-Version: 1..0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: SCONNECT <sconnect@saviance.com>' . "\r\n";
$headers .= 'Cc: kiran.jha@softwarefolks.com' . "\r\n";
if(mail ($to, $subject, $message, $headers )){
$msg = "Mail Sent Successfully";
}else {
$msg = "Mail Sending Failed";
}
}
?>
<html>
<head>
<title>
Mail test from script
</title>
</head>
<body>
<table width='60%' align='center' style="border:1px solid
#000">
<?php if($msg == ""){?>
<form method='post' action='mailtest.php'>
<tr><td colspan='2' align='center'><h4>This page
is used to test the mail from script.</h4></td></tr>
<tr><td>Email: </td><td> <input name='email'
type='text' /></td></tr>
<tr><td>Subject: </td><td><input name='subject'
type='text' /></td></tr>
<tr><td>Message:</td><td><textarea name='message'
rows='15' cols='40'></textarea></td></tr>
<tr><td colspan='2' align='center'> <input
type='submit' value='Send Mail' name='send'/></td></tr>
</form>
<?php }else{?>
<tr><td><?php echo $msg;?></td></tr>
<?php }?>
</table>
</body>
</html>
Regards.
Vikas Batra
Save all your chat conversations. Find them online at http://in.messenger.yahoo.com/webmessengerpromo.php