Mailing problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
suhasiniketha
Forum Newbie
Posts: 20
Joined: Wed Feb 04, 2009 10:20 pm

Mailing problem

Post by suhasiniketha »

Hi

I used this php code to send the mail

its working sometimes and not working sometimes.

can anyone help me please..............

Code: Select all

 
<?php $to=$_POST['email'];
 
   $from="admin@6sts.com";
   $header.= "From:".$from."\r\n";
$header.= "Content-Type: text/html\r\n\r\n";
 
   $mesg = "<html>
<body><font size = 2 face=verdana>
<br>";
$mesg.='<table width="450" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="400" align="left" valign="top" class="mainbgcolor"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="mini_inerbg">
      <tr>
        <td width="44%" height="100" align="left" valign="middle" style="padding-left:25px;"><img src="images/mini_logo.jpg" width="212" height="77" /></td>
        <td width="56%">&nbsp;</td>
      </tr>
      <tr>
        <td height="24" colspan="2" align="left" bgcolor="#D5E5EE" class="firstkolam" ><span class="forgotheading">Hi '.$_POST['fname'].' '.$_POST['lname'].'! </span></td>
        </tr>
      <tr>
        <td height="250" colspan="2" align="left" valign="top"><table width="520" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
              <td align="left" valign="top"><br />
                <p style="border-bottom:#999999 1px solid;"><br />
                 Welcome to 6students.com! <br/><br />Please keep this e-mail for your records. Your account information is as
                  follows:<br /><br /></p>
                <br />
                  <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td width="30%" height="30">User Name: </td>
                      <td width="70%">'.$_POST['user'].'</td>
                    </tr>
                    <tr>
                      <td height="30">Password:</td>
                      <td>'.$_POST['pwd'].'</td>
                    </tr>
                    <tr>
                      <td height="40" colspan="2">To login into 6students.com.please click <a href="javascript&#058;;">here</a></td>
                     
                    </tr>
                  </table>
                  <p>Thanks & regards, </p></td>
            </tr>
            <tr>
              <td align="left" valign="top"> 6students.com </td>
            </tr>
            <tr>
              <td align="left" valign="top">&nbsp;</td>
            </tr>
            <tr>
              <td align="left" valign="top">Contact Us: </td>
            </tr>
            <tr>
              <td align="left" valign="top"><a href="javascript&#058;;">click here to contact us</a></td>
            </tr>
          </table></td>
      </tr>
      
    </table></td>
  </tr>
</table></font></body></html>';
mail($to,"Login details",$mesg,$header);
    ?>     
 
User avatar
tom456
Forum Newbie
Posts: 22
Joined: Fri Aug 15, 2008 2:38 am

Re: Mailing problem

Post by tom456 »

suhasiniketha wrote:Hi

I used this php code to send the mail

its working sometimes and not working sometimes.

can anyone help me please..............

Code: Select all

 
<?php $to=$_POST['email'];
 
   $from="admin@6sts.com";
   $header.= "From:".$from."\r\n";
$header.= "Content-Type: text/html\r\n\r\n";
 
   $mesg = "<html>
<body><font size = 2 face=verdana>
<br>";
$mesg.='<table width="450" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="400" align="left" valign="top" class="mainbgcolor"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="mini_inerbg">
      <tr>
        <td width="44%" height="100" align="left" valign="middle" style="padding-left:25px;"><img src="images/mini_logo.jpg" width="212" height="77" /></td>
        <td width="56%">&nbsp;</td>
      </tr>
      <tr>
        <td height="24" colspan="2" align="left" bgcolor="#D5E5EE" class="firstkolam" ><span class="forgotheading">Hi '.$_POST['fname'].' '.$_POST['lname'].'! </span></td>
        </tr>
      <tr>
        <td height="250" colspan="2" align="left" valign="top"><table width="520" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
              <td align="left" valign="top"><br />
                <p style="border-bottom:#999999 1px solid;"><br />
                 Welcome to 6students.com! <br/><br />Please keep this e-mail for your records. Your account information is as
                  follows:<br /><br /></p>
                <br />
                  <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td width="30%" height="30">User Name: </td>
                      <td width="70%">'.$_POST['user'].'</td>
                    </tr>
                    <tr>
                      <td height="30">Password:</td>
                      <td>'.$_POST['pwd'].'</td>
                    </tr>
                    <tr>
                      <td height="40" colspan="2">To login into 6students.com.please click <a href="javascript&#058;;">here</a></td>
                     
                    </tr>
                  </table>
                  <p>Thanks & regards, </p></td>
            </tr>
            <tr>
              <td align="left" valign="top"> 6students.com </td>
            </tr>
            <tr>
              <td align="left" valign="top">&nbsp;</td>
            </tr>
            <tr>
              <td align="left" valign="top">Contact Us: </td>
            </tr>
            <tr>
              <td align="left" valign="top"><a href="javascript&#058;;">click here to contact us</a></td>
            </tr>
          </table></td>
      </tr>
      
    </table></td>
  </tr>
</table></font></body></html>';
mail($to,"Login details",$mesg,$header);
    ?>     
 
it's suppose to be slow server, that's all.. I had same problem like you have and when I moved to other server, then the mailfunction worked perfectly.
nmreddy
Forum Commoner
Posts: 25
Joined: Wed Feb 18, 2009 5:36 am

Re: Mailing problem

Post by nmreddy »

try with these headers

$headers.= "Content-Type: text/html; charset=ISO-8859-1 ";
$headers .= "MIME-Version: 1.0 ";
Post Reply