Monday, November 29, 2010

Mail function through php

http://phpfastcode.blogspot.com/2010/11/mail-function-through-php.html
  
       <?php
$a1=$_POST['name'];

$a2=$_POST['email'];

$a3=$_POST['phone'];

$a4=$_POST['mesg'];

$mail_from="http://phpfastcode.blogspot.com";
$mail_to= "yogeshbajapi@gmail.com";
$mail_sub="Order Forward from phpfastcode.";
$mail_mesg="The mail forward from phpfastcode.
****************************************************
Customer Information
****************************************************
Contact Person

   
Name :-$a1

E-mail :-$a2

Telephone :-$a3

Message :-$a4




************************************

*************************************


Thank from
phpfastcode";


?>
<p align="center"><font color="#008aff" size="4" face="Arial, Helvetica, sans-serif">
              <?php if(mail($mail_to,$mail_sub,$mail_mesg,"From: $mail_from \nX-Mailer: PHP/" . phpversion()))
                      
{
                $sub_user='phpfastcode';
                    $message="Hi There! \n\n Thank you for interest in our services,\n We hope to answer all emails within 1 business day, should you not get a reply please phone us or use our live help option!\n\n
Kind Regards, \n
The phpfastcode team \n
";
                    mail($a4,$sub_user,$message,"From: $mail_from \nX-Mailer: PHP/" . phpversion());
?>
           <font color="#008aff" size="4" > Thanks </font></p>
          <p align="center"><font color="#008aff" size="4" face="Arial, Helvetica, sans-serif">Your
            request have been submitted</font></p>
          <p>&nbsp;</p>
          <font color="#66CC33">
          <?php } else{
?>
          </font>
          <p align="center"><font color="#008aff" size="4" face="Arial, Helvetica, sans-serif">Sorry <?php echo $a1; echo " "; echo $a2;?></font></p>
          <p align="center"><font color="#008aff" size="4" face="Arial, Helvetica, sans-serif">Your
            request can not be submitted</font> <font face="Arial, Helvetica, sans-serif">
                          <?php } ?>
                        </font></p>              
  
  
   

config.php file,connection string in php

<?php
//session_cache_limiter("nocahe");
session_start();
ob_start();

/*$database="database name";
$host="localhost";
$userid="useridr";
$password="password";

mysql_connect($host,$userid,$password);
mysql_select_db($database) or die("Could not select database");*/
?>
<?
//session_cache_limiter("nocahe");
session_start();
$database="database name";
$host="localhost";
$userid="root";
$password="";
MySQL_connect($host,$userid,$password);
MySQL_select_db($database) or die("Could not select database");
?>