-1

Possible Duplicate:
How to send email with attachment using PHP?

hello iam new to php please let me know is any script or link for ( php script to send mail with file multiple attachments) and the html form also to how to connect this form or any inbuilt script so that i can upload to my server. i already try in many ways by coping the codes and pasting them and changing there path but still it get many errors so please let me know if there inbuilt script easily upload to my server

<?php
if($_GET['name']== '' || $_GET['email']=='' || $_GET['email']=='' || $_GET['Message']=='' )
{
?>

<form action="check3.php" method="get" name="frmPhone"> 
<fieldset> 
<legend style="color:#000">Contact    </legend>  
<table width="100%">
<tr>
<td width="29%">
<label for="name"     <?php     if(isset($_GET['Submit']) && $_GET['name']=='') echo "style='color:red'";    ?>>Name*    </label>     </td>    <td width="71%">
<input id="name" name="name" type="text" style="width:50%" value="    <?php echo $_GET['name'];    ?>"/>    </td>    </tr>    <tr>    <td>

<label for=" email"     <?php     if(isset($_GET['Submit']) && $_GET['email']=='') echo "style='color:red'";    ?>>Email*    </label>     </td>    <td>
<input id="email" name="email" type="text" style="width:50%" value="    <?php echo $_GET['email'];    ?>"/>     </td>    </tr>
</table>
</fieldset> 
<fieldset> 
<legend style="color:#000">Inquiry    </legend>  
<table width="100%">
  <tr>    <td width="41%" valign="top">

    <label for="Message"     <?php     if(isset($_GET['Submit']) && $_GET['Message']=='') echo "style='color:red'";    ?>>Message*</label>     </td>    <td width="59%">    <textarea name="Message" rows="5" style="width:90%" id="Message">    <?php echo $_GET['Message'];    ?>    </textarea> </td><div align="center">Photo
     <input name="photo" type="file" size="35" />
    </div></td>   
  </tr>
  <tr>

     <input name="Submit" type="submit" value="Submit" />
</form>    </td>    </td>




</form>

  </tr>

<?php
 }
else
{
$to      = 'abhi326@gmail.com';
$subject = 'Customer Information';
$message = '
Name: '.$_GET['name'].'
Email Address: '.$_GET['email'].'
Message: '.$_GET['Message'];

$headers = 'From:'.$_GET['email'];

mail($to, $subject, $message, $headers);

$connection=mysql_connect("db2173.perfora.net", "dbo311409166", "malani2002") or die(mysql_error());
 $query = mysql_query("INSERT INTO  `feedback` (  `name` ,  `email` , `Message` ,  `photo` ) VALUES ('".$_GET['name']."',  '".$_GET['email']."', '".$_GET['Message']."')");
define ("MAX_SIZE","75"); 
if(isset($_FILES['photo']['name']) && $_FILES['photo']['name']<>"")    {
$typ = $_FILES['photo']['type'];
    if($typ == "image/g    if" || $typ == "image/png" || $typ == "image/jpeg" || $typ == "image/pg    if" || $typ == "image/ppng" || $typ =="image/JPEG")
    {
    $uploaddir = "contacts/";
    $uploadimages = $uploaddir.basename($_FILES['photo']['name']);
        if(move_uploaded_file($_FILES['photo']['tmp_name'], $uploadimages))      {
        echo "File successfully copied";
        $sql="INSERT INTO contacts (Photo, Beschrijving)
        VALUES ('$uploadimages',
                            '$_POST[images]')";
            if (!mysql_query($sql,$con))    {
            die('Error: ' . mysql_error());
            mysql_close($con);
             }
         }
        else    {echo "Copy unsuccessful";     }
     }
    else    { 
    echo "Incorrect file type";
     }
 }
else    {
echo "No file selected";
 }
echo "Thank you! ";
 }
?>

thanks and regards abhi

Community
  • 1
  • 1
abhi
  • 1
  • 3

1 Answers1

1

The script you're lookingfor is phpMailer.

This script can be downloaded and is easily added to your PHP programs. It makes sending emails from PHP extremely easy, including adding attachments.

Hope that helps.

Spudley
  • 166,037
  • 39
  • 233
  • 307
  • My personal preference is swiftmailer.org but either way, both phpMailer and SwiftMailer can do the job. – bumperbox Oct 14 '12 at 20:06
  • @bumperbox: You could add that as an answer at the duplicate question: http://stackoverflow.com/questions/2027069/how-to-send-email-with-attachment-using-php – hakre Oct 14 '12 at 21:46