Jump to content

ChandanMendiratta

New Members
  • Posts

    1
  • Joined

  • Last visited

Posts posted by ChandanMendiratta

  1. Hi Guys,

    I just write the code in php but mail function is not working rest everything is working fine.. i tried other script but that also not working.. Than i came to know that my hosting server only use SMTP.. So i need help to do that..

     

    Code Below

     

    <?php
    class patient_mail
    {
     
    function mail_send($c)
    {
    global $db;
    $db->fun_db();
    global $img_obj;
    $img=array();
    $time=time();
    $to = 'team@concepteurs.co.in';
    $fromEmail = $_REQUEST['email'];
    $fromName = $_REQUEST['comment_name'];
    $subject = $_REQUEST['contactno'];
    $message = $_REQUEST['comment'];
    $message1 = $_REQUEST['comment'];
    //$message.="You have receive An request from $c Page From the user/Patient $fromName";
     
    //var_dump($_FILES);
     
    $headers = "From: $fromName";
     
    /* GET File Variables */
     
    if($_FILES['report']['name'][0]!=''){
     
    foreach( $_FILES['report']['name']as $k=>$value)
     
    {
     
    $time++;
     
    $tmpName = $_FILES['report']['tmp_name'][$k];
     
    $fileType = $_FILES['report']['type'][$k];
     
     
    /* Start of headers */
     
    $filename = stripslashes($_FILES['report']['name'][$k]);
     
    $ext = explode(".",$value);
     
    $extension = strtolower(end($ext));
     
     
     
    $tempname = $_FILES['report']['tmp_name'][$k];
     
    $userimg = "mail_".$time.".".$extension;
     
    $folder = "../images/mail/";
     
     
     
    $img[]=$userimg;
     
    $newwidth = "";
     
    $newheight = "154";
    if($ext!='exe'){
    move_uploaded_file($tempname,$folder.$userimg);
    }
     
     
    if (file($tmpName)) {
     
     /* Reading file ('rb' = read binary)  */
     
     $file = fopen($tmpName,'rb');
     
     $data = fread($file,filesize($tmpName));
     
     fclose($file);
     
     }
     
     
     
     $randomVal = md5(time());
     
     $mimeBoundary = "==Multipart_Boundary_x{$randomVal}x";
     
     
     
     /* Header for File Attachment */
     
     $headers .= "\nMIME-Version: 1.0\n";
     
     $headers .= "Content-Type: multipart/mixed;\n" ;
     
     $headers .= " boundary=\"{$mimeBoundary}\"";
     
     
     
     /* Multipart Boundary above message */
     
     $message = "This is a multi-part message in MIME format.\n\n" .
     
     "--{$mimeBoundary}\n" .
     
     "Content-Type: text/plain; charset=\"iso-8859-1\"\n" .
     
     "Content-Transfer-Encoding: 7bit\n\n" .
     
     $message . "\n\n";
     
     
     
     /* Encoding file data */
     
     $data = chunk_split(base64_encode($data));
    /* Adding attchment-file to message*/
     
     
     
     $message .= "--{$mimeBoundary}\n" .
     
     "Content-Type: {$fileType};\n" .
     
     " name=\"{$value}\"\n" .
     
     "Content-Transfer-Encoding: base64\n\n" .
     
     $data . "\n\n" .
     
     "--{$mimeBoundary}--\n";
     
     
     
    }
     
    $userimg=implode(',',$img);
     
    }
     
     
     
      $sql="insert into treatment_mail(comment_name,email,contactno,message,page_id,report1,mail_date)values('".$fromName."','".$fromEmail."','".$subject."','".$message1."','".$c."','".$userimg."','".time()."')"; 
     
    mysql_query($sql);
     
     
     
    $flgchk = mail ("$to", "$subject", "$message", "$headers");       /* this code is not working*/
     
     
     
    if($flgchk){
     
    echo $msg="A email has been sent to: $to";
     
    }
     
    else{
     
     echo $msg= "Error in Email sending"; 
     
    }
     
    return $msg;
     
    }
     
     
    }
     
    $obj_mail=new patient_mail();
     
    ?>
×
×
  • Create New...

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.