bflosabre91 Posted June 25, 2007 Share Posted June 25, 2007 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 More sharing options...
bflosabre91 Posted June 25, 2007 Author Share Posted June 25, 2007 well i guess more specifically my question is, do i need to use a database of any type to allow for a file attachment or can i still just use SMTP?thanks Link to comment https://forums.phpfreaks.com/topic/57133-email-with-attachment/#findComment-282339 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.