Jump to content

email with attachment


bflosabre91

Recommended Posts

i want to alter this code for email to include attachments of txt or doc files. can someone possibly point me in the direction on how to do this?

 

<?php include('includes/header.php'); ?>
<div id="body">
<form method="post" action="sendmail.php">
  <table id="emailform" align="center">
  <tr>
  <td>First Name: </td>
  <td><input name="firstName" type="text"/></td>
  </tr>
  <tr>
  <td>Last Name: </td>
  <td><input name="lastName" type="text"/></td>
  </tr>
  <tr>
  <td>Email: </td>
  <td><input name="email" type="text"<br /></td>
  </tr>
  <tr>
  <td valign="top">Message:</td>
  <td><textarea name="message" rows="15" cols="50"></textarea><br />
  <input type="submit" value="Submit" /></td>
  </tr>
  </table>
</form>
</div><!--ending div id= body-->
<?php include('includes/footer.php'); ?>

<?php
/*Here we are going to declare the variables*/
$firstName = $_POST['firstName'];
$lastName = $_POST['lastName'];
$email = $_POST['email'];
$message = $_POST['message'];
//Save visitor name and entered message into one variable:
$formcontent="VISITOR NAME: $firstName $lastName\n\nMessage: $message";
$recipient = "[email protected]";
$subject = "Contact Form";
$mailheader = "From: $email\r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Failure!");
echo "Thank You!";
?>
<?php
header( 'Location: mailconfirm.php' ) ;
?>

 

thanks to anyone with any information

Link to comment
https://forums.phpfreaks.com/topic/57133-email-with-attachment/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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