JJohnsenDK Posted November 27, 2006 Share Posted November 27, 2006 Heyi got this script where i want to add a variable which can send files with the mails, how do i do that?Here is the code:[code]if ($_POST[op] == "send") { $file = $_POST['file']; $subject = $_POST['subject']; //want to send form, so check for required fields if ($_POST[subject] =="") { echo "Du har ikke skrevet et emne."; exit; } if($_POST[message] == "") { echo "Du har ikke skrevet noget tekst."; exit; } $subject = wordwrap($subject, 77, "<br />\n"); //connect to database $conn = mysql_connect("localhost", "user", "pass") or die(mysql_error()); mysql_select_db("db",$conn) or die(mysql_error()); //get emails from subscribers list $sql = "select email from subscribers"; $result = mysql_query($sql,$conn) or die(mysql_error()); //create a From: mailheader $header = "From: Katrinelund\n"; //loop through results and send mail while ($row = mysql_fetch_array($result)) { set_time_limit(0); $email = $row['email']; mail("$email", stripslashes($_POST[subject]), stripslashes($_POST[message]), $header); print "Nyhedsbrev sendt til: $email<br>"; } }[/code] Link to comment https://forums.phpfreaks.com/topic/28621-how-do-i-send-a-file-with-formmail/ Share on other sites More sharing options...
JJohnsenDK Posted November 27, 2006 Author Share Posted November 27, 2006 anyone? Link to comment https://forums.phpfreaks.com/topic/28621-how-do-i-send-a-file-with-formmail/#findComment-131026 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.