Jump to content

Php Mail issue


_Firebird_

Recommended Posts

Hey all i'm having a small phpmail problem and need some aid.

 

when it emails me it sends my images i've selected in my form but it says "Cannot be viewed"

 

The php file

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head>



<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">

<link rel="stylesheet" type="text/css" href="file:///C|/Documents and Settings/Kate/Local Settings/Temporary Internet Files/OLK63/application.css">



<style type="text/css">

<!--

.style1 {font-size: 24px}

-->

</style></head>

<body>
<?php

    // Program Registration To
   $ArtistName=  $_POST["artist_name"];
   $Website=  $_POST["website"];
   $PhoneNumber=  $_POST["phone_number"];
   $Email=  $_POST["email"];
   $Address=  $_POST["address"];
   $Needstudio=  $_POST["need_studio"];
   $Hostguest=  $_POST["host_guest"];
   $Numberofguests=  $_POST["number_of_guests"];
   $Comments=  $_POST["comments"];
   $Mailpayment=  $_POST["mail_payment"];
   $image1= $_FILES['firstpic']['name'];
    $image2=$_FILES['secondpic']['name'];
   $image3= $_FILES['thirdpic']['name'];

// array with filenames to be sent as attachment
$files = array("$image1","$image2","$image3");   

// email fields: to, from, subject, and so on
$to = "mramos@mwtnetworks.com";
$from = $Email;
$subject ="Studio Tour Application"; 

//Begin the message.  Be sure to change this how you want it.
$message.= "Artist Name:";
$message.= $ArtistName;
$message.= "\n";
$message.= "Website:";
$message.= $Website;
$message.= "\n";
$message.= "Phone Number:";
$message.= $PhoneNumber;
$message.= "\n";
$message.= "Email:";
$message.= $Email;
$message.= "\n";
$message.= "Address:";
$message.= $Address;
$message.= "\n\n";
$message.= "Need a studio:";
$message.= $Needstudio;
$message.= "\n\n";
$message.= "Host s guest:";
$message.= $Hostguest;
$message.= "\n\n";
$message.= "Number of guests:";
$message.= $Numberofguests;
$message.= "\n\n";
$message.= "Comments:";
$message.= $Comments;
$message.= "\n";
$message.= "Mail in payment:";
$message.= $Mailpayment;
$message.= "\n";
$message.= "Image1:";
$message.= $image1;
$message.= "\n";
$message.= "Image2:";
$message.= $image2;
$message.= "\n";
$message.= "Image3:";
$message.= $image3;
$message.= "\n";


$headers = "From: $from";

// boundary 
$semi_rand = md5(time()); 
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x"; 

// headers for attachment 
$headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\""; 

// multipart boundary 
$message = "This is a multi-part message in MIME format.\n\n" . "--{$mime_boundary}\n" . "Content-Type: text/plain; charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $message . "\n\n"; 
$message .= "--{$mime_boundary}\n";

// preparing attachments
for($x=0;$x<count($files);$x++){
   $file = fopen($files[$x],"rb");
   $data = fread($file,filesize($files[$x]));
   fclose($file);
   $data = chunk_split(base64_encode($data));
   $message .= "Content-Type: {\"application/octet-stream\"};\n" . " name=\"$files[$x]\"\n" . 
   "Content-Disposition: inline;\n" . " filename=\"$files[$x]\"\n" . 
   "Content-Transfer-Encoding: base64\n\n" . $data . "\n\n";
   $message .= "--{$mime_boundary}\n";
}

// send

$ok = @mail($to, $subject, $message, $headers); 
if ($ok) { 


} else { 
   echo "<p>mail could not be sent!</p>"; 
} 

?> 
<table class="schedule">



<tbody>



<tr>



<td> </td>
</tr>



<tr>



<td>



<hr></td>
</tr>



<tr>



<td></td>
</tr>



<tr>



<td>



<hr></td>
</tr>



<tr>



<td align="center">Electronic Application Received</td>
</tr>



<tr>



<td align="center" valign="middle">Thank You for Applying online!  Please review your information:
  <br/><?
  print $ArtistName;
  print "<br>";
  print   $Website;
  print "<br>";
  print   $PhoneNumber;
  print "<br>";
  print   $Email;
  print "<br>";
  print   $Address;
  print "<br>";
  print "Need a studio ";
  print   $Needstudio;
  print "<br>";
  print "Host a guest";
  print   $Hostguest;
  print "<br>";
  print "Number of guests";
  print   $Numberofguests;
  print "<br>";
  print   $Comments;
  print "<br>";
  print   $Mailpayment;
  print "<br>";
  print   $image1;
  print "<br>";
  print   $image2;
  print "<br>";
  print   $image3;
  print "<br>";
   
   
   

  ?>  </td>
</tr>



<tr>



<td>



<hr></td>
</tr>



<tr>



<td>



<p style="text-align: center;">If you see an error in your information,



please email us with changes on the contact page.<br>
</p>



</td>
</tr>



<tr>



<td>



<hr></td>
</tr>



<tr>



<td> </td>
</tr>
</tbody>
</table>



</body></html>

 

the Html file

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--
.style1 {   color: #990000;
   font-style: italic;
}
-->
</style>
</head>

<body>
<form action="form-submit.php" method="post" enctype="multipart/form-data" name="form1" id="form1">
  <label for="artist_name">Artist Name</label>
  <br />
  <input type="text" name="artist_name" id="artist_name" />
  <br />
  <br />
  <label for="website">Website</label>
  <br />
  <input type="text" name="website" id="website" />
  <br />
  <br />
  <label for="phone_number">Phone Number</label>
  <br />
  <input type="text" name="phone_number" id="phone_number" />
  <br />
   <br />
  <label for="email">Email</label>
  <br />
   <input type="text" name="email" id="email" />
   <br />
   <br />
  <label for="address">Address</label>
  <br />
  <textarea name="address" cols="35" rows="6" id="address"></textarea>
  <hr />
<br />
   Do you need a shared studio location?<br />
   <br />
<label>
   <input type="radio" name="need_studio" value="Yes" id="Do you need a studio location?_0" />
Yes</label>
   <br />
   <label>
   <input type="radio" name="need_studio" value="No" id="Do you need a studio location?_1" />
No</label>
   <br />
      </span><br />
      <hr />
      If you have your own studio would you host a guest?<br />
      <br />
  <p>
        <label>
        <input type="radio" name="host_guest" value="Yes" id="Host a guest_0" />
          Yes</label>
        <br />
        <label>
        <input type="radio" name="host_guest" value="No" id="Host a guest_1" />
          No</label>
        <br />
        <br />
        If "Yes" how many ?<br />
  <br />
  <label for="number_of_guests"></label>
  <input name="number_of_guests" type="text" id="number_of_guests" size="6" />
  </p><hr />
      <p>Upload three photos. (300 dpi, 5"x 7")<br />
        <br />
    <span class="style1"><u>Image #1 will be used for the Brochure.</u></span> </p>
      <p>Image 1:
        <label>
          <input type="file" name="firstpic" id="firstpic" />
        </label>
(Brochure img.)<br />
<br />
Image 2:
<label>
  <input type="file" name="secondpic" id="secondpic" />
</label>
<br />
<br />
Image 3:
<label>
  <input type="file" name="thirdpic" id="thirdpic" />
</label>
<br />
<br />
<hr />
<label for="comments">Artist Comments</label>
: 25 words or less.
<br />
<textarea name="comments" cols="35" rows="6" id="comments"></textarea>
<br />
<br />
<hr />
<p>PayPal Payment: <br />
     <br />
    <img src="paypal.jpg" alt="paypal" width="160" height="35" /> 
     <label for="paypal"> </label>
     <br />
     <br />
</p>
<p>
  <label for="mail_payment">Mail in Payment:</label>
   <input type="radio" name="mail_payment" id="mail_payment" value="yes" />
   <br />
   <br />
   (Note: Application will not be processed until payment is recieved. <br />
   Please make your cheque payable to Barrie Spring Art Tour)<br />
</p>
<hr />
  <input type="submit" name="saveform" id="saveform" value="Submit" />
   <input type="reset" name="reset" id="reset" value="Reset" />
   <br />
   <br />
   <hr /></p>
</p>
</form>
</body>
</html>

 

a live link at http://dev.mwtnetworks.org/Formom/Mail%20form/indexspringtour2.html

 

Mod edit:

 . . . 

tags added.

 

Link to comment
Share on other sites

  • 2 weeks later...

Hey all i'm having a small phpmail problem and need some aid.

 

when it emails me it sends my images i've selected in my form but it says "Cannot be viewed"

 

The php file

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head>



<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">

<link rel="stylesheet" type="text/css" href="file:///C|/Documents and Settings/Kate/Local Settings/Temporary Internet Files/OLK63/application.css">



<style type="text/css">

<!--

.style1 {font-size: 24px}

-->

</style></head>

<body>
<?php

    // Program Registration To
   $ArtistName=  $_POST["artist_name"];
   $Website=  $_POST["website"];
   $PhoneNumber=  $_POST["phone_number"];
   $Email=  $_POST["email"];
   $Address=  $_POST["address"];
   $Needstudio=  $_POST["need_studio"];
   $Hostguest=  $_POST["host_guest"];
   $Numberofguests=  $_POST["number_of_guests"];
   $Comments=  $_POST["comments"];
   $Mailpayment=  $_POST["mail_payment"];
   $image1= $_FILES['firstpic']['name'];
    $image2=$_FILES['secondpic']['name'];
   $image3= $_FILES['thirdpic']['name'];

// array with filenames to be sent as attachment
$files = array("$image1","$image2","$image3");   

// email fields: to, from, subject, and so on
$to = "mramos@mwtnetworks.com";
$from = $Email;
$subject ="Studio Tour Application"; 

//Begin the message.  Be sure to change this how you want it.
$message.= "Artist Name:";
$message.= $ArtistName;
$message.= "\n";
$message.= "Website:";
$message.= $Website;
$message.= "\n";
$message.= "Phone Number:";
$message.= $PhoneNumber;
$message.= "\n";
$message.= "Email:";
$message.= $Email;
$message.= "\n";
$message.= "Address:";
$message.= $Address;
$message.= "\n\n";
$message.= "Need a studio:";
$message.= $Needstudio;
$message.= "\n\n";
$message.= "Host s guest:";
$message.= $Hostguest;
$message.= "\n\n";
$message.= "Number of guests:";
$message.= $Numberofguests;
$message.= "\n\n";
$message.= "Comments:";
$message.= $Comments;
$message.= "\n";
$message.= "Mail in payment:";
$message.= $Mailpayment;
$message.= "\n";
$message.= "Image1:";
$message.= $image1;
$message.= "\n";
$message.= "Image2:";
$message.= $image2;
$message.= "\n";
$message.= "Image3:";
$message.= $image3;
$message.= "\n";


$headers = "From: $from";

// boundary 
$semi_rand = md5(time()); 
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x"; 

// headers for attachment 
$headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\""; 

// multipart boundary 
$message = "This is a multi-part message in MIME format.\n\n" . "--{$mime_boundary}\n" . "Content-Type: text/plain; charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $message . "\n\n"; 
$message .= "--{$mime_boundary}\n";

// preparing attachments
for($x=0;$x<count($files);$x++){
   $file = fopen($files[$x],"rb");
   $data = fread($file,filesize($files[$x]));
   fclose($file);
   $data = chunk_split(base64_encode($data));
   $message .= "Content-Type: {\"application/octet-stream\"};\n" . " name=\"$files[$x]\"\n" . 
   "Content-Disposition: inline;\n" . " filename=\"$files[$x]\"\n" . 
   "Content-Transfer-Encoding: base64\n\n" . $data . "\n\n";
   $message .= "--{$mime_boundary}\n";
}

// send

$ok = @mail($to, $subject, $message, $headers); 
if ($ok) { 


} else { 
   echo "<p>mail could not be sent!</p>"; 
} 

?> 
<table class="schedule">



<tbody>



<tr>



<td> </td>
</tr>



<tr>



<td>



<hr></td>
</tr>



<tr>



<td></td>
</tr>



<tr>



<td>



<hr></td>
</tr>



<tr>



<td align="center">Electronic Application Received</td>
</tr>



<tr>



<td align="center" valign="middle">Thank You for Applying online!  Please review your information:
  <br/><?
  print $ArtistName;
  print "<br>";
  print   $Website;
  print "<br>";
  print   $PhoneNumber;
  print "<br>";
  print   $Email;
  print "<br>";
  print   $Address;
  print "<br>";
  print "Need a studio ";
  print   $Needstudio;
  print "<br>";
  print "Host a guest";
  print   $Hostguest;
  print "<br>";
  print "Number of guests";
  print   $Numberofguests;
  print "<br>";
  print   $Comments;
  print "<br>";
  print   $Mailpayment;
  print "<br>";
  print   $image1;
  print "<br>";
  print   $image2;
  print "<br>";
  print   $image3;
  print "<br>";
   
   
   

  ?>  </td>
</tr>



<tr>



<td>



<hr></td>
</tr>



<tr>



<td>



<p style="text-align: center;">If you see an error in your information,



please email us with changes on the contact page.<br>
</p>



</td>
</tr>



<tr>



<td>



<hr></td>
</tr>



<tr>



<td> </td>
</tr>
</tbody>
</table>



</body></html>

 

the Html file

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--
.style1 {   color: #990000;
   font-style: italic;
}
-->
</style>
</head>

<body>
<form action="form-submit.php" method="post" enctype="multipart/form-data" name="form1" id="form1">
  <label for="artist_name">Artist Name</label>
  <br />
  <input type="text" name="artist_name" id="artist_name" />
  <br />
  <br />
  <label for="website">Website</label>
  <br />
  <input type="text" name="website" id="website" />
  <br />
  <br />
  <label for="phone_number">Phone Number</label>
  <br />
  <input type="text" name="phone_number" id="phone_number" />
  <br />
   <br />
  <label for="email">Email</label>
  <br />
   <input type="text" name="email" id="email" />
   <br />
   <br />
  <label for="address">Address</label>
  <br />
  <textarea name="address" cols="35" rows="6" id="address"></textarea>
  <hr />
<br />
   Do you need a shared studio location?<br />
   <br />
<label>
   <input type="radio" name="need_studio" value="Yes" id="Do you need a studio location?_0" />
Yes</label>
   <br />
   <label>
   <input type="radio" name="need_studio" value="No" id="Do you need a studio location?_1" />
No</label>
   <br />
      </span><br />
      <hr />
      If you have your own studio would you host a guest?<br />
      <br />
  <p>
        <label>
        <input type="radio" name="host_guest" value="Yes" id="Host a guest_0" />
          Yes</label>
        <br />
        <label>
        <input type="radio" name="host_guest" value="No" id="Host a guest_1" />
          No</label>
        <br />
        <br />
        If "Yes" how many ?<br />
  <br />
  <label for="number_of_guests"></label>
  <input name="number_of_guests" type="text" id="number_of_guests" size="6" />
  </p><hr />
      <p>Upload three photos. (300 dpi, 5"x 7")<br />
        <br />
    <span class="style1"><u>Image #1 will be used for the Brochure.</u></span> </p>
      <p>Image 1:
        <label>
          <input type="file" name="firstpic" id="firstpic" />
        </label>
(Brochure img.)<br />
<br />
Image 2:
<label>
  <input type="file" name="secondpic" id="secondpic" />
</label>
<br />
<br />
Image 3:
<label>
  <input type="file" name="thirdpic" id="thirdpic" />
</label>
<br />
<br />
<hr />
<label for="comments">Artist Comments</label>
: 25 words or less.
<br />
<textarea name="comments" cols="35" rows="6" id="comments"></textarea>
<br />
<br />
<hr />
<p>PayPal Payment: <br />
     <br />
    <img src="paypal.jpg" alt="paypal" width="160" height="35" /> 
     <label for="paypal"> </label>
     <br />
     <br />
</p>
<p>
  <label for="mail_payment">Mail in Payment:</label>
   <input type="radio" name="mail_payment" id="mail_payment" value="yes" />
   <br />
   <br />
   (Note: Application will not be processed until payment is recieved. <br />
   Please make your cheque payable to Barrie Spring Art Tour)<br />
</p>
<hr />
  <input type="submit" name="saveform" id="saveform" value="Submit" />
   <input type="reset" name="reset" id="reset" value="Reset" />
   <br />
   <br />
   <hr /></p>
</p>
</form>
</body>
</html>

 

a live link at http://dev.mwtnetworks.org/Formom/Mail%20form/indexspringtour2.html

 

Mod edit:

 . . . 

tags added.

 

Are you using absolute urls for the images??

ex: http://yoursite.com/imageFolder/imageFile.ext

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.