Jump to content

Archived

This topic is now archived and is closed to further replies.

tanveer

Can't send mail using mail()

Recommended Posts

Hi all:
I am facing a strange problem here.
I developed a small application where after filling up a form when users press SUBMIT button then an auto mail will be sent to an address locally. We are under a windows domain say, abc.com.

There are two types of address, those who are using internet to send receive mail from both locally and from outside address (like yahoo) is <username@abc.com.bd> and others only can send-receive mail locally is <username@abc.com>.
Both type of users can easily send-receive mails between them.

So, I just edited these two lines of php.ini file
[php.ini]
SMTP = xyz.abc.com.bd // gave our smtp server name
sendmail_from = "tanveer@abc.com.bd" // my email address

So after changing I restarted the apache server and sent mail. But after that one time I cant send mails anymore.
It gives a warning like: [b]Can't receive in ..... in line 5. [/b]
That is the line where the mail() function is written. But that same file, if I upload it in our webserver then it works fine.

What could be the problem?
Thanks in advance.


Share this post


Link to post
Share on other sites
thanks for your reply.
feedback.htm
[code]
<form name="feedback" method="post" action="feedback.php">
                    
        <table width="610" height="249" style="border:0px solid #b4b4b4" cellspacing="0" cellpadding="0" align="left">
        <tr>
          <td width="38%" height="29"><div align="left"><img src="images/feedback.jpg" width="215" height="22">
          </div></td>
          <td width="62%"> </td>
        </tr>
        <tr class="style5">
          <td height="24"><span class="style13"> Name </span></td>
          <td><input type="text" name="name" value="" maxlength="35" style="border:1px solid #000000"></td>
        </tr>
        <tr class="style5">
          <td height="24"><span class="style13">Telephone</span></td>
          <td><input type="text" name="telephone" value="" maxlength="35" style="border:1px solid #000000"></td>
        </tr>
         <tr class="style5">
          <td height="24"><span class="style13">Email</span></td>
          <td><input type="text" name="email" value="" maxlength="35" style="border:1px solid #000000"></td>
        </tr>
         <tr class="style5">
          <td height="24"><span class="style13">Comments</span></td>
          <td><textarea name="comments"  style="border:1px solid #000000"></textarea></td>
        </tr>
        <tr class="style5">
          <td height="17"> </td>
          <td> </td>
        </tr>
        <tr class="style5">
          <td align="center" height="35"><input type="submit" value="Submit" name="submit"></td>
          <td align="left"><input type="reset" value="Reset" name="reset"></td>
        </tr>
        <tr class="style5">
          <td height="24" colspan="2" align="center"><img src="images/div.jpg" width="611" height="19"></td>
      </tr>
      </table>      
      </form>
[/code]

feedback.php
[code]
<?php
  if ( empty($_POST[email]) || empty ($_POST[name])|| empty ($_POST[comments]))
    {

       if (empty($_POST[email]))  echo "<center><b> Email address is a required field </b></center>";
       if (empty($_POST[name]))  echo "<center><b> Name is a required field </b></center>";
       if (empty($_POST[comments]))  echo "<center><b> Comments is a required field </b></center>";

       }

else {

$from=$_POST[email];

$headers= "From: $from \r\n";
$headers .= "MIME-Version:1.0\n" . "Content-type: text/html; charset=iso-8859-1";

mail ("tanveer@abc.com.bd","Website Feedback",$_POST[comments], $headers);

echo "YOUR COMMENTS HAS BEEN SUCCESSFULLY SUBMITTED TO THE WEBMASTER";

}
?>
[/code]

The same code will work if I upload it to the webserver using ftp.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.