Jump to content

sending mail function attachments with php mail() function


Recommended Posts

Hello Everyone

 

I have written a simple mail function to be emailed to a certain person on submission.  On submission they would also like to have attachments sent to them.

 

I got the email being sent but I can;t get the attachments to work. I have read several different examples and tutorials and none of them work.

 

This is my code so far without any code for file attachment

<?php

$project_name = $_POST['project_name'];
$needed = $_POST['date_needed'];
$submitted = $_POST['date_submitted'];
$department = $_POST['department'];
$contact = $_POST['contact_person'];
$extension = $_POST['extension'];
$project_type = $_POST['project_type'];
$published = $_POST['date_last_published'];
$description = $_POST['description'];
$color = $_POST['color'];
$pdf = $_POST['pdf_needed'];
$web = $_POST['web_needed'];
$quanity = $_POST['quanity'];

$email = "mdmartiny@sc4.edu";  
$subject = "SC4 Graphics Design Service Request Form";  

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

$message = "<html><body>
<table width=\"100%\" border=\"0\" cellspacing=\"5px\" >
<tr><td></td>
<td>Project name: $project_name</td>
<td></td>
<td>Date needed by: $needed</td>
</tr>
<tr>
<tr>
<td></td>
<td colspan=\"3\" align=\"left\" valign=\"top\"><strong><font size=\"+1\">Submitted to graphic designer</font></strong></td></tr>
<tr><td height=\"25\"></td><td>Date $submitted</td><td>Department $department</td><td></td></tr>
<tr><td height=\"25\"></td><td>Contact Person $contact</td><td>Extension $extension</td><td></tr>
<tr><td height=\"25\"></td><td>Type of project $project_type</td><td colspan=\"2\">Approximate date of last publication $published</td></tr>
<tr><td height=\"25\"></td><td colspan=\"3\">Project description/special instructions</td>
<tr><td></td>><td colspan=\"3\">$description</td></tr>
<tr><td height=\"25\"></td><td>Color $color</td><td>PDF needed $pdf</td><td>Website update needed $web</td></tr>
<tr><td ></td><td>Estimated print quanity $quanity</td><td></td><td></td></tr>
<tr>
    <td colspan=\"4\" align=\"left\" valign=\"top\"><hr height=\"5\"/>
<strong><font size=\"+1\">Graphics office use only</font></strong></td>
  </tr>
  <tr>
    <td height=\"25\" width=\"2%\"> </td>
    <td width=\"34%\">Print Shop    Color copier</td>
    <td colspan=\"2\">Print Vendor_______________________________________</td>
  </tr>
  <tr>
    <td height=\"25\"> </td>
    <td><strong><font size=\"+1\">Project tracking</font></strong></td>
    <td> </td>
    <td> </td>
  </tr>
  <tr>
    <td height=\"25\"> </td>
    <td colspan=\"3\">Received by graphic designer_______________________   Date _______</td>
  </tr>
  <tr>
    <td height=\"25\"> </td>
    <td colspan=\"3\">
  <table width=\"100%\" height=\"35\">
  <tr>
  <td>Approved by executive director__________   Date_________</td><td><input type=\"checkbox\">
      Revisions needed<br /><input type=\"checkbox\"> 
      Revisions made ______   Date_______</td><tr>
  </table>
  </td>
  </tr>
  <tr>
    <td height=\"25\"> </td>
    <td colspan=\"3\">Completed and spell checked by graphic designer___________________________  Date__________</td>

  </tr>
  <tr>
    <td> </td>
    <td align=\"center\" colspan=\"3\">
    <table cellpadding=\"10px\" cellspacing=\"0\" border=\"1\" width=\"100%\">
    <tr bgcolor=\"#CCCCCC\">
    <td>
<table>
	<tr>
	<td>
    Proofread by marketing coordinator __________   Date__________</td>
</tr>
<tr>
<td>
    Proofread by secretary __________   Date__________ 
</td>
</tr>
</table>
    </td>
    <td>
    <input type=\"checkbox\">
Revisions needed  
<br>
<input type=\"checkbox\">
Revisions made ____   Date_____
    </td>
    </tr>
    </table></td>
  </tr>
  <tr>
  <td></td>
  <td colspan=\"3\">
  <table width=\"100%\" height=\"75\">
  <tr>
  <td>Proofread by executive director______ Date______ </td><td><input type=\"checkbox\">
      Revisions needed<br />
  <input type=\"checkbox\"> Revisions made ______   Date_______</td>
  </tr>
  </table>
  </td>
  </tr>
  <tr>
  <td></td>
  <td colspan=\"3\">
  <table width=\"100%\" height=\"75\">
  <tr>
  <td>
  Approval by requesting department __________ Date_________ <br />
     <strong><font size=\"-1\">(Include all paperwork when returning)</font></strong></td><td><input type=\"checkbox\">
      Revisions needed<br /><input type=\"checkbox\"> 
      Revisions made ______   Date_______</td>
  </tr>
  </table>
  </td>
  </tr>
  <td></td height=\"25\">
  <td colspan=\"3\">Final approval by executive director _________________________________________ Date_________ </td>
  </tr>
  <tr>
  <td height=\"75\"></td>
  <td><input type=\"checkbox\"> Printed ____ Date _____</td>
  <td colspan=\"2\"><input type=\"checkbox\"> PDF created _____ Date _____<br />
<input type=\"checkbox\"> Website updated _____ Date _____</td>
  </tr>
</table>";
		$message .= "</body></html>";

mail($email, $subject, $message, $headers, "From: $email");  

echo "The email has been sent.";  

?> 

  • 3 weeks later...
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.