PHP - Trouble With This Email Code
Hi,
I have this email code working for me: $headers1 = "From: my@email.com\r\n"; $headers1 .= "BCC: other@email.com\r\n"; $to1 = $_GET['e1'].", ". $_GET['e2'].", ". $_GET['e3'].", ". $_GET['e4']; mail($to1, " my subject line", " my message here ", $headers1); In the forms users can submit up to 4 independent email addresses (but are not required to do so) in any combination. This email from works only if email address 1 and 4 are entered. Other can be entered too, but if 1 and 4 are not there email does not go out. I sort of understand why, but I can not figure out a way around it and I do not want to split to 4 independent email codes. Any help on this one? Thanks Similar TutorialsI need to send emails with single apostrophes in the body of my email function. How do I do that without erroring out in my mail function. Code: [Select] <? $to = "myself@gmail.com"; $subject = "test"; $body='<html><body><font size="1"> We're sending this email.It's been a while</font></body></html>'; $message=$total; $from = "webmaster@example.com"; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: Admin <Admin@test.com>' . "\r\n"; // Send email if(mail($to,$subject,$body,$headers)) { // Inform the user echo "Your email has been sent"; } else { echo "MAIL not sent"; } ?> I use this type of a code to send automatic emails from my website: Code: [Select] $headers = ; $headers .= ; $to = ; Click here to go to Google. ", $headers); I am having hard time figuring out how to do hyperlink on words (like here). If I do something like this: Code: [Select] <a href='http://www.google.com'>here</a> it spits out that exact thing out. Thanks you for your input I have an html form that is submitted to php page that alocated the data to database and automatically sends out selected data to other php page for them to be emailed. Most of it works but final few steps. HTML form code looks like this: <form name="thisform" method="post" action="thankyou.php"> Zip : <input name="zip" type="text" id="zip" size="5" maxlength="5"> <input type="submit" name="submit" value="Submit This Form"/> PHP code has this, amongst others... (thankyou.php) There is other code there as well and it works... <?php file_get_contents("http://otherdomain.com/azsef/email.php?zip=$zip"); ?> And the email.php has this code: <?php $headers = "From: myemail@gmail.com\r\n"; $headers .= "BCC: otheremail@gmail.com\r\n"; mail($_POST[''], "email", " $_POST[zip] ", $headers); ?> When I fill out the form submit it I get to the thankyou.php and all the data is send to the database as well as I get a blank email which can only come from email.php on otherdomain.com. Everything works, but I can not get the zip to be emailed, but I get the email. Why? I'm having trouble with my code, any help would be appreciated. I'm trying to add an if statement that checks if $new =1, if it does it echos "new" else it echos "old". What is happening is if $new ="0 or 1 " it echos the same answer. Here is partial code: Code: [Select] $result = mysql_query("SELECT * FROM $dbname WHERE new = '1'") or die(mysql_error()); // store the record of the "" table into $row $current = ''; // keeps getting the next row until there are no more to get while($row = mysql_fetch_array( $result )) { $id = $row['id']; if (!$current) { echo "<center><div><table border='0' width='520'>"; $current = $id; echo "<img src='images/jewelry.png' alt='toveco'/><br/>"; echo "<div>"; echo "Questions about store items use link in menu.<br/>"; echo "Latest (".$rows5.") "; echo "Beads (".$rows4.") "; echo "Cabochons (".$rows3.") "; echo "Earrings (".$rows1.") "; echo "Pendants (".$rows2.") "; echo "Rings (".$rows0.") "; echo "</div>"; echo "<p><b>Click picture to enlarge.</b></p>"; echo "<hr width='520'>"; } elseif ($current != $id){ echo "</table></div><br><div><table border='0' width='520'>"; $current = $id; echo "<hr width='520'>"; } ?> <tr><td rowspan="9" width="110"><div class="image"><a href="<?= $row['image']; ?>" rel="lightbox" title="<?= $row['material']; ?>"><img src="<?= $row['image_th']; ?>" align="center" border="0"></a></div></td> <td rowspan="9" width="110"><div class="image"><a href="<?= $row['image2']; ?>" rel="lightbox" title="<?= $row['material']; ?>"><img src="<?= $row['image2_th']; ?>" width="75" border="0"></a></div></td> <tr><td> <?php if ($new=="0") echo "new"; else echo "old "; ?> </td></tr> <tr><th align="left">Item No.</th><td><?= $row['itemno']; ?></td></tr> <tr><th align="left">Description</th><td><?= $row['description']; ?></td></tr> <tr><th align="left">Cut</th><td><?= $row['cut']; ?></td></tr> <tr><th align="left">Carat</th><td><?= $row['carat']; ?></td></tr> <tr><th align="left">Material</th><td><?= $row['material']; ?></td></tr> <tr><th align="left">Price</th><td><?= $row['price']; ?></td></tr> <tr><th align="left">Availability</th><td><?= $row['availability']; ?></td></tr> <tr><th></th> <td></td> I have this simple form that registers schools. This year I have decide to upgrade and include a feature that checks if the school is already registered or not based on the imputed name. Here is the code (that is the only way I know how): mysql_connect("", "", "") or die(mysql_error( '' )); mysql_select_db("") or die(mysql_error( '' )); $query = "SELECT * FROM School_Registrations WHERE School_Name= '$_POST[SchoolName]' "; $result = mysql_query($query); if (mysql_numrows($result) > 0) { while($row = mysql_fetch_array($result)) echo" error code here";} else {mysql_query("INSERT INTO `database`.`School_Registrations` (all the variables here);") or die(mysql_error( '' )); echo "Success Code";} I am trying to incorporate this code somewhere into the 'else' statement but I have no luck. I am constantly getting some errors and when I fix one there is one more to take its place. I am lost. The last one I can not fix and I am not sure what it wants from me: Fatal error: Call to undefined function getPage() It works by itself without the if/else statement but not in the code listed above $url = 'http://www.otherpage.com/page.php?'; $url .= 'email='.urlencode($_POST['email']); $result2 = getPage('', $url, '', 15); function getPage($proxy, $url, $header, $timeout) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, $header); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_PROXY, $proxy); curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); curl_setopt($ch, CURLOPT_REFERER, 'http://azsef.org'); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.8) Gecko/2009032609 Firefox/3.0.8'); $result2['EXE'] = curl_exec($ch); $result2['INF'] = curl_getinfo($ch); $result2['ERR'] = curl_error($ch); curl_close($ch); return $result2; } Can you tell me why doesn't it work? Thanks Hello, I have this code running and I keep getting "Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/.../search.php on line 10 Any help would be appreciated <table><tr><td>ID</td><td>SCHOOL NAME</td><td>TEACHER NAME</td></tr> <?php if(isset($_POST['submit'])){ if(isset($_GET['go'])){ if(preg_match("/^[ a-zA-Z]+/", $_POST['name'])){ $name=$_POST['name']; $db=mysql_connect ("", "", "") or die ('I cannot connect to the database because: ' . mysql_error()); $mydb=mysql_select_db(""); $sql="SELECT ID, school_name, teacher_name FROM Project_Registration WHERE school_name LIKE '%" . $name . "%'"; $result=mysql_query($sql); while($row = mysql_fetch_array($result, MYSQL_ASSOC)){ echo "<tr><td> {$row['ID']} </td>" . "<td> {$row['school_name']} </td>" . "<td> {$row['teacher_name']} </td></tr>";}}}} ?> </table> I am trying to insert into my database and it's just not having non of it. No errors are comming up at all, but no data is getting passed through. Code: [Select] if(isset($_POST['sub'])) { include("../scrips/php/cms/database.insert.class.php"); $table = "blog_posts"; $title = $_POST['ArticleTitle']; $img = "2"; $post = $_POST['ArticleBody']; $aurthor_id = "1"; $category_id = "4"; $date_posted = "NOW()"; $values = array("$title","$img","$post","$aurthor_id","$category_id","$date_posted"); $fields = array('title','img','post','aurthor_id','category_id','date_posted'); //echo $values['0']."<br/>".$fields['0']; //$obj->ArticleInsert($table,$fields,$tvalues); $values_imploded = implode("','",$values); $fields_imploded = implode(",",$fields); $i = "INSERT INTO $table ($values_imploded) VALUES ($fields_imploded)"; mysql_query($i) or die( "<br>Query string: <br>Produced error: " . mysql_error() );; } Help with PHP Email Code I am currently designing a PHP website and i have been following some useful tutorials but one that i have followed i have come unstuck with and it wont work. If anyone could help me with the code below it would be a great help. First of all we have the contact.html form Code: [Select] <html> <head> <title>Ajax Contact Form by Andrew Walsh</title> <style type="text/css"> body { margin:50px 0px; padding:0px; text-align:center; } #contactarea { width:350px; margin:0px auto; text-align:left; padding:15px; border:1px solid #333; background-color:#eee; font-weight: bold; font-family: Verdana, Arial; font-size: 12px; } #inputbox { border: 1px solid #000; width: 270; padding: 2px; font-weight: bold; font-family: Verdana, Arial; font-size: 12px; } #inputlabel { font-weight: bold; font-family: Verdana, Arial; font-size: 12px; } #textarea { border: 1px solid #000; padding: 2px; font-weight: bold; font-family: Verdana, Arial; font-size: 12px; width:330; } #submitbutton { border: 1px solid #000; background-color: #eee; } </style> <script language="javascript"> function createRequestObject() { var ro; var browser = navigator.appName; if(browser == "Microsoft Internet Explorer"){ ro = new ActiveXObject("Microsoft.XMLHTTP"); }else{ ro = new XMLHttpRequest(); } return ro; } var http = createRequestObject(); function sendemail() { var msg = document.contactform.msg.value; var name = document.contactform.name.value; var email = document.contactform.email.value; var subject = document.contactform.subject.value; document.contactform.send.disabled=true; document.contactform.send.value='Sending....'; http.open('get', 'contact.php?msg='+msg+'&name='+name+'&subject='+subject+'&email='+email+'&action=send'); http.onreadystatechange = handleResponse; http.send(null); } function handleResponse() { if(http.readyState == 4){ var response = http.responseText; var update = new Array(); if(response.indexOf('|' != -1)) { update = response.split('|'); document.getElementById(update[0]).innerHTML = update[1]; } } } </script> </head> <body> <div id="contactarea"> <form name="contactform" id="contactform"> <span id="inputlabel">Name:</span> <input type="text" name="name" id="inputbox"> <span id="inputlabel">Email:</span> <input type="text" name="email" id="inputbox"> <span id="inputlabel">Subject:</span> <input type="text" name="subject" id="inputbox"> <span id="inputlabel">Message:</span> <textarea name="msg" rows="10" id="textarea"></textarea> <input type="button" value="Send Email" name="send" onclick="sendemail();" id="submitbutton"> </form> </div> </body> </html> Then we have the contact.php form <?php /* Author: Andrew Walsh Date: 30/05/2006 Codewalkers_Username: Andrew This script is a basic contact form which uses AJAX to pass the information to php, thus making the page appear to work without any refreshing or page loading time. */ $to = "mike2fast135@hotmail.com"; //This is the email address you want to send the email to $subject_prefix = ""; //Use this if you want to have a prefix before the subject if(!isset($_GET['action'])) { die("You must not access this page directly!"); //Just to stop people from visiting contact.php normally } /* Now lets trim up the input before sending it */ $name = trim($_GET['name']); //The senders name $email = trim($_GET['email']); //The senders email address $subject = trim($_GET['subject']); //The senders subject $message = trim($_GET['msg']); //The senders message mail($to,$subject,$message,"From: ".$email.""); //a very simple send echo 'contactarea|Thank you '.$name.', your email has been sent.'; //now lets update the "contactarea" div on the contact.html page. The contactarea| tell's the javascript which div to update. ?> From what i can gather the HTML form passes the information to the PHP form which then sends the information to your email address. I have changed the email address to the one that i want to use and have also tried using a different one incase it did not like the one i have chosen to use. If anyone could help with this i would really appreciate it. Thanks Posts: 1 Joined: Thu Mar 31, 2011 12:03 pm Top The attached code works except the email portion. This code allows a user to upload a file(s) to a network share & has a few check mark boxs for John Doe & Jane Doe. If the box for John or Jane is checked it is suppose to send them an email once submit is pressed but the email does not get sent. Can someone help me out on this? Thanks Hi guys, I have a booking form on my website for potential customers to request a booking. The form asks for their Name, Address, Email and Tel No. I need the code to be able to send the form by Php. I also need it to show an error message if they haven't completed any of the fields. The fields on my form a Name, Address, District, City, Postcode, Tel No, Email. Please help. HI everyone, I am sure this has got to be common question. Is there a way to tell if an email recipient opened an email I sent? Here is the scenario. In an application where the application sends email campaigns. So, if I send out an email to 100 people, I want to keep track of how many of them actually opened the email. I do not want to rely on a reader clicking a link, or downloading image to determine if the "read" the email, as one can still read an email without doing those things. Is there a more reliable way? Thanks Kipper i have a page in my website with PHP , that do a customer comment and it send me an emails for those comments , and then send an automatic email to the customer , but my only problem is that i want the customer to receive the email as it is from the email i got my emails on , but when the customer received the email it received as my username in my host site @ hostsite.com i want to solve this please thanks. here is the code : <?php require_once('recaptchalib.php'); $errFlag=0; $showForm=1; //KEEP YOUR PRIVATE KEY HERE $privatekey = ""; // << replace this key with yours function isValidEmail($email){ return filter_var(filter_var($email, FILTER_SANITIZE_EMAIL), FILTER_VALIDATE_EMAIL); } if (isset($_POST["submit"])){ $name=$_POST['name']; $lname=$_POST['lname']; $phone=$_POST['phone']; $email=$_POST['email']; $message=$_POST['message']; if(empty($_POST)) { $errMsg[]="Please enter all the field."; } if(empty($name)) { $errMsg[]="Please enter your First Name."; } if(empty($lname)) { $errMsg[]="Please enter your Last Name."; } if(empty($phone)) { $errMsg[]="Please enter phone number."; } elseif(!is_numeric($phone)) { $errMsg[]="Please enter valid phone number."; } if(empty($email)) { $errMsg[]="Please enter an email address."; } elseif(!isValidEmail($email)) { $errMsg[]="Please enter an valid email address."; } if(empty($message)) { $errMsg[]="Please enter message."; } /* captcha validation */ $resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if (!$resp->is_valid) { // What happens when the CAPTCHA was entered incorrectly $errMsg[]="The CAPTCHA wasn't entered correctly. Please try it again."; } if(empty($errMsg)) { // if there is no error then send a mail $ToEmail = 'myreiki11@gmail.com'; // CHANGE YOUR EMAIL WHERE YOU WANT TO RECEIVE THE CONTACT FORM SUBMITTED BY USERS... $EmailSubject = 'Customer Comments '; $mailheader = "From: ".$email."\r\n"; $mailheader .= "Reply-To: ".$email."\r\n"; $mailheader .= "Content-type: text/html; charset=iso-8859-1\r\n"; $MESSAGE_BODY = "Name: ".$name." ".$lname."<br>"; $MESSAGE_BODY .= "Phone: ".$phone."<br>"; $MESSAGE_BODY .= "Email: ".$email."<br>"; $MESSAGE_BODY .= "Comment: ".nl2br($message)."<br>"; mail($ToEmail, $EmailSubject, $MESSAGE_BODY, $mailheader) or die ("Failure"); if(mail) { $msg="Thank your for submitting the form, we will contact your shortly."; $showForm=0; mail($email, "Thank your for submitting.", $msg); } else { $msg="Some errors occured, please try again in a while."; } } else { $errFlag=1; } } ?> <html xmlns:v="urn:schemas-microsoft-com:vml" xmlns="urn:schemas-microsoft-comfficeffice" xmlns="http://www.w3.org/TR/REC-html40"> <head> <link rel="shortcut icon" href="http://www.divineenergyhealing.co/favicon.ico"> <meta http-equiv="Content-Language" content="en-us"> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>Customer Comments</title> <meta name="description" content="Customer Comments"> <link rel="File-List" href="reiki website/Reiki/Customer Comments_files/filelist.xml"> <base target="_self"> <!--[if !mso]> <style> v\:* { behavior: url(#default#VML) } o\:* { behavior: url(#default#VML) } .shape { behavior: url(#default#VML) } </style> <![endif]--><!--[if gte mso 9]> <xml><o:shapedefaults v:ext="edit" spidmax="1027"/> </xml><![endif]--> <style type="text/css"> /* error and success msg */ #errMsg { background-color:#febbbb; border:1px solid #d31a1c; color:#d31a1c; font-size:12px; padding:10px; margin-bottom:15px;} #successMsg { background-color:#ffffff; border:1px solid #ffffff; color:#000000; font-size:16px; padding:10px; margin-bottom:15px; margin-top:25px;} #contact_form { position: absolute; width: 888px; height: 365px; z-index: 1; left: 190px; top: 128px;} #contact_form form label { display:block;} contact_form p { margin-bottom:10px;} .auto-style1 { font-family: "Times New Roman", Times, serif; font-weight: bold; color: #FFFFFF; } </style> </head> <body link="#0000FF" vlink="#800000" alink="#FF0000"> <p> </p> <p align="left"> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p align="left"> </p> <div id="contact_form" style="left: 192px; top: 102px"> <?php if($errFlag) { echo "<div id='errMsg'>"; foreach($errMsg as $val) { echo "- "; echo $val; echo "<br />"; } echo "</div>"; } ?> <?php if($showForm){ ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" name="contact_form" method="post"> <p> <label for="name">First Name</label> <input name="name" type="text" id="name" value="<?php if (isset($_POST['name'])) echo $_POST['name']; ?>" /> </p> <p style="height: 45px"> <label for="lname">Last Name</label><input name="lname" type="text" id="lname" style="width: 148px; height: 22px" value="<?php if (isset($_POST['lname'])) echo $_POST['lname']; ?>" /> </p> <p> <label for="phone">Phone Number</label> <input name="phone" type="text" id="phone" value="<?php if (isset($_POST['phone'])) echo $_POST['phone']; ?>" /> </p> <p> <label for="email">Email Address</label> <input name="email" type="text" id="email" value="<?php if (isset($_POST['email'])) echo $_POST['email']; ?>" /> </p> <p> <label for="message">Customer Comments</label> <textarea name="message" id="message" style="width: 247px; height: 84px" rows="999"><?php if (isset($_POST['message'])) echo $_POST['message']; ?></textarea> </p> <p> <?php //PUT YOUR PUBLIC KEY HERE $publickey = ""; // << replace this key echo recaptcha_get_html($publickey); ?> </p> <p><input name="submit" type="submit" value="Submit" /> <input name="reset" type="reset" value="Reset" /></p> </form> <?php } else { ?> <div id="successMsg" class="auto-style1">Thanks for your comments and questions we appreciate that you took the time to send us..</div> <?php }?> </div> </body> </html> i wanting users to be able to update there email address and check to see if the new email already exists. if the email is the same as current email ignore the check. i have no errors showing up but if I enter a email already in the db it still accepts the new email instead of bringing the back the error message. Code: [Select] // email enterd from form // $email=$_POST['email']; $queryuser=mysql_query("SELECT * FROM members WHERE inv='$ivn' ") or die (mysql_error()); while($info = mysql_fetch_array( $queryuser )) { $check=$info['email']; // gets current email // } if($check!=$email){ // if check not equal to $email check the new email address already exists// $queryuser=mysql_query("SELECT * FROM members WHERE email='$email' "); //$result=mysql_query($sql); $checkuser=mysql_num_rows($queryuser); if($checkuser != 0) { $error= "0"; header('LOCATION:../pages/myprofile.php?id='.$error.''); } } cheers Hi everyone.
Pretty desperate, first time that I'm working with php. Learning this language, makes sense, however I can't figure out why my code is not working.
Emails are not coming in at all. Additional required info (phone number, first name, last name) should be included in the message.
Please help. Thank you everyone.
<?php $to = "abcd@abcd.com"; $subject = "From Website Contact Form"; $first = $_REQUEST['first']; $last = $_REQUEST['last']; $email = $_REQUEST['email']; $phone = $_REQUEST['phone']; $MESSAGE_BODY = "Name: " . $_POST["first"] . "\n"; $MESSAGE_BODY = "Name: " . $_POST["last"] . "\n"; $MESSAGE_BODY = "Contact No: " . $_POST["phone"] . "\n"; $MESSAGE_BODY = "Email: " . $_POST["email"] . "\n"; $MESSAGE_BODY = "Requirement: " . nl2br($_POST["message"]) . "\n"; $message = $_REQUEST['message' + 'email' + 'first' + 'last']; $from = $_REQUEST['email']; $headers = "From:" . $from; mail($to, $subject, $MESSAGE_BODY, $headers); echo "Your message has been sent"; ?> The attached code works perfect for me. This code displays data from my mysql database in a browser & allows me to edit it, then re-submit it to the mysql database. Again, all of this works great. I was wondering if there was a way way for me to add some code to this existing code that would send me an email with the information in the form when the submit button is clicked? Nothing fancy....I'd just like to get an email based off of the location, for example if the location is changed from "Office1" to "Office2", I'd like the email to go to office2@mail.com. If "Office3" is entered, I'd like the form info to go to office3@mail.com. Is this possible? Hello I'm completely new with php and need some help. Basically I'm at a level that I can tweak it but I'm still learning on how to write it. I have a form within an html page. This form has multiple text inputs and a upload button. Once the user hits the submit button it triggers the mailer.php. I've done tons of searches online today and in forums and people keep mentioning php mailer as a good tool. I looked into this and was confused on how to implement it. I don't need the info sent to a database, just emailed. The uploaded file just needs to be sent to a temp directory and then deleted after the file is emailed. The inputs would be in the body of the email and the uploaded file would be attached. This is the php code I'm working with for a starting point. Any help would be greatly appreciated. Code: [Select] <?PHP $to = "email@email.com"; $subject = "New Employee Application"; $headers = "From:" . $from; $forward = 1; $location = ""; $date = date ("l, F jS, Y"); $redirect = "../thanks.html"; $msg = "New Employee Application. It was submitted on $date.\n\n"; if ($_SERVER['REQUEST_METHOD'] == "POST") { foreach ($_POST as $key => $value) { $msg .= ucfirst ($key) ." : ". $value . "\n"; } } else { foreach ($_GET as $key => $value) { $msg .= ucfirst ($key) ." : ". $value . "\n"; } } mail($to, $subject, $msg, $headers); if ($forward == 1) { header ("Location: $redirect"); } else { echo "Your application has been sent."; } ?> Hi, I am using the following PHP email code, and when I send it to my Gmail account it works fine, but some servers are blocking this email and are not being received. How can I tweak it to make it more compatible? Code: [Select] $headers = "From: $row_o_email[email] \r\n"; $headers .= "BCC: $row_o_email[email] \r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $to = $row_e['email']; mail($to, "subject", " email body ", $headers); Ok so I followed Buddski's advice to use MIME for the attatchment. (thanks for the help by the way, definitely headed in the right direction now.... i think...) The image now successfully uploads to temp_folder on submit, the email is then delivered with correct text variables (name, phone, address etc.). However, instead of their being an image included - there is just raw code. If anyone could help with the final fix you may just save my sanity! Thanks. Code: [Select] <?php ini_set("sendmail_from", "darren@mywebsite.co.uk"); ini_set("SMTP", "smtp.myhosts.co.uk"); // Subject and Email Destinations // $emailSubject = 'Work Email!'; $webMaster = 'darren@mywebsite.co.uk'; // Gathering Data Variables // $name = trim($_POST['name']); // create a unique boundary string // $semi_rand = md5(time()); $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x"; // Add the headers for a file attachment // $headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\""; // Add a multipart boundary above the plain message // $message ="This is a multi-part message in MIME format.\n\n"; $message.="--{$mime_boundary}\n"; $message.="Content-Type: text/plain; charset=\"iso-8859-1\"\n"; $message.="Content-Transfer-Encoding: 7bit\n\n"; $message.= "Name: ".$name."\n"; //The file type of the attachment // $file_type = 'text/csv'; // The place the files will be uploaded to (currently a 'files' directory) // $upload_path = './uploads/'; // Get the name of the file (including file extension) // $filename = $_FILES['userfile']['name']; // Get the extension from the filename // $ext = substr($filename, strpos($filename,'.'), strlen($filename)-1); // Configuration of File Uploaded // $allowed_filetypes = array('.jpg','.JPEG','.jpeg','.gif','.bmp','.png'); $max_filesize = 2000000; (move_uploaded_file($_FILES['userfile']['tmp_name'],$upload_path . $filename)); //This attatches the image file to the email // $message .= chunk_split(base64_encode(file_get_contents($upload_path . $filename))); // Send the Email with the attatchment. $success = mail($webMaster, $emailSubject, $message, $headers, "-fdarren@dsinteriorsltd.co.uk"); ?> >>>is returning this to my email... Code: [Select] MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="==Multipart_Boundary_x9cbb390d8be528476c5423025ed1e4ccx" This is a multi-part message in MIME format. --==Multipart_Boundary_x9cbb390d8be528476c5423025ed1e4ccx Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Name: darren /9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEB AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/2wBDAQEBAQEBAQEBAQEBAQEBAQEBAQEB AQEBAQEB........................................................... ..........this code goes on like this for ages. i want send scheduled email. please help me how can i write code in php |