PHP - Symbols In My Email When Sending Thr. Contactus ? (arabic Related)
When using this form to send emails I got symbols in my emails (especially when typing Arabic characters) ? for the English characters it's OK
http://www.blog.aiwwan.com/contact.php Similar TutorialsFrom our website we are connecting to GMAIL to send our emails through SMTP. For some reason it is not sending the emails to the CC or BCC email address event though GMAIL shows it was included in the email. Am I missing something in the below code? Code: [Select] $currentTime = time(); $emailTo = "redbrad0@domain.com"; $emailCC = "brad@domain.com"; $emailBCC = "events@domain.com"; $emailSubject = "TEST Email at (" . $currentTime . ")"; $emailBody = "This is the body of the email"; $headers = array(); if (!empty($emailTo)) $headers['TO'] = $emailTo; if (!empty($emailCC)) $headers['CC'] = $emailCC; if (!empty($emailBCC)) $headers['BCC'] = $emailBCC; if (!empty($emailSubject)) $headers['Subject'] = $emailSubject; $headers['From'] = "events@domain.com"; $mime = new Mail_mime("\n"); $mime->setTXTBody($emailBody); $body = $mime->get(); $headers = $mime->headers($headers); $mail = Mail::factory('smtp', array ('host' => 'ssl://smtp.gmail.com', 'auth' => true, 'port' => 465, 'username' => 'events@domain.com', 'password' => 'thepasswordhere')); try { $result = $mail->send($emailTo, $headers, $emailBody); } catch (TixException $ex) { echo "<font color=red>Error:" . $ex->getCode() . "</font><br>"; } echo "Emailed at (" . $currentTime . ")<br>"; die; Everything about the email is sending except the message text does anyone know what the issue could be? here is the block of code that sends the email Thanks in advance Code: [Select] $image = "http://www.visualrealityink.com/dev/clients/arzan/snell_form/images/email.png"; echo "got to process form"; $target_path = "upload/"; $path = $target_path = $target_path . basename( $_FILES['file']['name']); $boundary = '-----=' . md5( uniqid ( rand() ) ); $message .= "Content-Type: application/msword; name=\"my attachment\"\n"; $message .= "Content-Transfer-Encoding: base64\n"; $message .= "Content-Disposition: attachment; filename=\"$path\"\n\n"; echo $path; $fp = fopen($path, 'r'); do //we loop until there is no data left { $data = fread($fp, 8192); if (strlen($data) == 0) break; $content .= $data; } while (true); $content_encode = chunk_split(base64_encode($content)); $message .= $content_encode . "\n"; $message .= "--" . $boundary . "\n"; $message .= $image . "<br />" . $_POST['name'] . "submitted a resume on our website. Please review the applications and contact the candidate if their resume is a fit for any open opportunities with the company. <br><br> Thank you. <br><br> SEI Team"; $headers = "From: \"Me\"<me@example.com>\n"; $headers .= "MIME-Version: 1.0\n"; $headers .= "Content-Type: multipart/mixed; boundary=\"$boundary\""; mail('george@visualrealityink.com', 'Email with attachment from PHP', $headers, $message); Hi the user fill details and then the email his sent to me the only problem is that the emails keeps going to my spam, can someone help me out please I looked already php website and email format looks the same. This is the link to my form. http://www.people.eurico.co.uk/ here my form script Code: [Select] <?php // Set email variables $email_to = 'xxxxx@xxxxxxx.co.uk'; $email_subject = 'Call back form'; // Set required fields $required_fields = array('fullname','email','telephone','comment'); // set error messages $error_messages = array( 'fullname' => 'Please enter a Name to proceed.', 'email' => 'Please enter a valid Email.', 'telephone' => 'Please telephone.', 'comment' => 'Please enter your Message to continue.' ); // Set form status $form_complete = FALSE; // configure validation array $validation = array(); // check form submittal if(!empty($_POST)) { // Sanitise POST array foreach($_POST as $key => $value) $_POST[$key] = remove_email_injection(trim($value)); // Loop into required fields and make sure they match our needs foreach($required_fields as $field) { // the field has been submitted? if(!array_key_exists($field, $_POST)) array_push($validation, $field); // check there is information in the field? if($_POST[$field] == '') array_push($validation, $field); // validate the email address supplied if($field == 'email') if(!validate_email_address($_POST[$field])) array_push($validation, $field); } // basic validation result if(count($validation) == 0) { // Prepare our content string $email_content = 'peoplesmartlearning.co.uk: ' . "\n\n"; // simple email content foreach($_POST as $key => $value) { if($key != 'submit') $email_content .= $key . ': ' . $value . "\n"; } // if validation passed ok then send the email mail($email_to, $email_subject, $email_content); // Update form switch $form_complete = TRUE; } } function validate_email_address($email = FALSE) { return (preg_match('/^[^@\s]+@([-a-z0-9]+\.)+[a-z]{2,}$/i', $email))? TRUE : FALSE; } function remove_email_injection($field = FALSE) { return (str_ireplace(array("\r", "\n", "%0a", "%0d", "Content-Type:", "bcc:","to:","cc:"), '', $field)); } ?> The HTML Code: [Select] <div class="call_us_form"> <p class="title">WE'LL CALL YOU BACK</p> <?php if($form_complete === FALSE): ?> <form class="contact_form" id="fm-form" method="post" action="index.php" > <fieldset> <div class="fm-req"> <label for="fm-firstname">Name</label> <input type="text" id="fullname" class="detail" name="fullname" value="<?php echo isset($_POST['fullname'])? $_POST['fullname'] : ''; ?>" /> <?php if(in_array('fullname', $validation)): ?><script type="text/javascript">alert("Please enter a Name"); history.back();</script><?php endif; ?> </div> <div class="fm-req"> <label for="fm-firstname">Email</label> <input type="text" id="email" class="detail" name="email" value=" <?php echo isset($_POST['email'])? $_POST['email'] : ''; ?>" /> <?php if(in_array('email', $validation)): ?><script type="text/javascript">alert("Please enter a valid Email Address"); history.back();</script><?php endif; ?> </div> <div class="fm-req"> <label for="fm-firstname">Number</label> <input type="text" id="telephone" class="detail" name="telephone" value="<?php echo isset($_POST['telephone'])? $_POST['telephone'] : ''; ?>" /> <?php if(in_array('telephone', $validation)): ?><script type="text/javascript">alert("Please enter telephone number"); history.back();</script><?php endif; ?> </div> <div class="fm-req"> <label for="fm-lastname">Message</label> <textarea cols="40" rows="5" id="comment" name="comment" class="mess"><?php echo isset($_POST['comment'])? $_POST['comment'] : ''; ?></textarea> <?php if(in_array('comment', $validation)): ?><script type="text/javascript">alert("Please enter your message"); history.back();</script><?php endif; ?> </div> <input class="submit_button" type="submit" value="Call us" /> </fieldset> </form> <?php else: ?> <p>Thank you for your Message!</p> <p>We will get back to you as soon as we can</p> <script type="text/javascript"> setTimeout ('ourRedirect()', 5000) function ourRedirect () { location.href='index.php' } </script> <?php endif; ?> Code: [Select] $sql="SELECT * FROM $tbl_name3 WHERE review_show='n'"; $result=mysql_query($sql); $num_results=mysql_num_rows($result); if($num_results > 1){ $message="You have ".$num_results." reviews unapproved."; mail('example@example.com','GHP Reviews', $message, 'From: example@example.com'); } $sql2="SELECT * FROM $tbl_name4 WHERE rma_issued='n'"; $result2=mysql_query($sql2); $num_results2=mysql_num_rows($result2); if($num_results2 > 1){ $message="You have ".$num_results2." RMA Numbers Requested."; mail('example@example.com','GHP RMA Number Requests', $message, 'From: example@example.com'); } The reviews email is being sent, however, the RMA email is not. EDIT: Nevermind, $num_results and $num_results2 should have been > 0 not > 1. Can someone help me understand why an email isn't being sent after clicking submit? Code: [Select] <?php error_reporting(E_ALL); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <?php extract ($_POST); if(!isset($submit)) { ?> <form action=" " method="post" name="test"> Name: <input name="name " type="text" id="name " size="8" /><br /> phone <input name="phone" type="text" size="13" /><br /> email <input name="email" type="text" size="9" maxlength="30" /><br /> <input name="submit" type="submit" value="submit" /> </form> <?php $Recipient = "$email"; $MsgSubject = "message subject"; $MsgHeader = "From Auntie Vic's Treatery <auntievics@gmail.com>\r\n"; $MsgBody = "message body."; mail($Recipient, $MsgSubject, $MsgBody, $MsgHeader); } else { echo " thank you for your order. It is being processed. Thank you for your business."; } ?> </body> </html> Hi
I have below code :
<?php $_SERVER['SERVER_NAME']; $to = "info@domain.com"; $subject = "Test mail"; $body = $_SERVER['SERVER_NAME']; $from = "user@example.com"; $headers = "From:" . $from; mail($to, $subject, $body, $headers) ?>the email is sent correctly but without any body text . I use $_SERVER['SERVER_NAME']; but nothing show as body . I want to use this code load each day becuse I want to know which domain is used my script. but now the code not work. I am creating a forgotten password button, it works but it just doesn't send me an email containing the reset link.
Here's the code for the email part:
<?php require("../config.php"); if($_GET['code']) { $get_username = $_GET['username']; $get_code = $_GET['code']; $query = mysql_query("SELECT * FROM users WHERE username='$get_username'"); while($row = mysql_fetch_assoc($query)) { $db_code = $row['passreset']; $db_username = $row['username']; } if($get_username == $db_username && $get_code == $db_code) { echo " <form action='pass_reset_complete.php?code=$get_code' method='POST'> Enter a new password<br><input type='password' name='newpass'><br> Re-enter your password<br><input type='password' name='newpass1'><p> <input type='hidden' name='username' value='$db_username'> <input type='submit' value='Update Password!'> </form> "; } } if(!$_GET['code']) { echo " <form action='forgot_pass.php' method='POST'> Enter your username<br><input type='text' name='username'><p> Enter your email<br><input type='text' name='email'><p> <input type='submit' value='Submit' name='submit'> </form> "; if(isset($_POST['submit'])) { $username = $_POST['username']; $email = $_POST['email']; $query = mysql_query("SELECT * FROM users WHERE username='$username'"); $numrow = mysql_num_rows($query); if($numrow!=0) { while($row = mysql_fetch_assoc($query)) { $db_email = $row['email']; } if($email == $db_email) { $code = rand(10000,1000000); $to = $db_email; $subject = "Password Reset"; $body = " This is an automated email. Please DO NOT reply to this email. Click the link below or paste it into your browser http:/www.***REMOVED***.com/second/forgot_pass.php?code=$code&username=$username "; mysql_query("UPDATE users SET passreset='$code' WHERE username='$username'"); mail($to,$subject,$body); echo "Check Your Email"; } else { echo "Email is incorrect"; } } else { echo "That username doesnt exist"; } } } ?> Hey guys, Coding something for a survey as no solution exists for our needs. I have not finished the code as I still need to do error checks + making it spam proof. Anyway I am not reciving the email even though it says that I have been sent it. Any suggestions are appreciated, please ask if you need additional info to be able to help, and thank you in advanced. Code: [Select] <?php error_reporting(0); if(isset($_POST['submit'])){ //Check that all fields that are mandatory are filled in and that the $Email variable is real $Title = $_POST['Title']; $FirstName = $_POST['FirstName']; $LastName = $_POST['LastName']; $Email= $_POST['Email']; $Country= $_POST['Country']; $State= $_POST['State']; $List= $_POST['List']; $Nav= $_POST['Nav']; $IssuesYes= $_POST['IssuesCheck']; $IssuesList= $_POST['IssuesList']; $Satisfaction= $_POST['Satisfaction']; $Improvement= $_POST['Improvement']; $ValueSatisfaction= $_POST['Value']; $Recommendation= $_POST['Recommend']; $Knowledge= $_POST['Knowledge']; $Comments= $_POST['Comments']; $Gender= $_POST['Gender']; $Age= $_POST['Age']; $Source= $_POST['Source']; $ContactNumber= $_POST['Contact']; $Newsletter= $_POST['Newsletter']; $errors = array(); //Check that the fields above are not empty: $to = "email@email.com";//Obviously not real one that I am sending to. $subject = "Survey Form Submission"; $from = $to; $ip = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : ''; $body = "$name submitted the survey form:\n". "This is what they responded with to each question: <br>". "Their Name: $Title $FirstName $LastName <br>"."Email: $Email <br>"."Country: $Country <br>"."State: $State<br>"."Bought: $List<br>"."Website Navigation: $Nav<br>"."Issues: $IssuesYes " ." $IssuesList"."Satisfaction: $Satisfaction<br>"."Improvement: $Improvement<br>"."Value Satisfaction: $ValueSatisfaction<br>"."Reccomend: $Recommendation<br>"."Knowledge: $Knowledge<br>"."Comments: $Comments <br>"."Gender: $Gender<br>"."Age: $Age <br>"."Source for Finding Us: $Source <br>"."Contact: $ContactNumber<br>"."Subscribe to Newsletter?: $Newsletter<br>"; $headers = "From: $from \r\n"; $headers .= "Reply-To: $visitor_email \r\n"; if( mail($to, $subject, $body,$headers)){ echo "Email Send!"; }else{ echo "Somethings wrong :\ "; } // header('Location: http://www.********/thank-you-for-survey'); } ?> Hi Guys I am creating a site which allows the registration of new users. I already have my user registration page up and running which is lnked to my database. I would now like to add a function which will send a 'welcome to...' email to the email address provided on the registration form provided by the new user. Could anybody please point me in the right direction i.e where to start? I am using dreamweaver and Cpanel. Thanksin advance this is my email.php file <?php $senderName =$_POST['userName']; $senderEmail =$_POST['userEmail.']; $senderMessage =$_POST['userMessage.']; //security $senderName=stripslashes($userName); $senderEmail=stripslashes($userEmail); $senderMsg=stripslashes($userMessage); $to = 'myName@mydomain.com'; $from = 'myName@mydomain.com'; $subject = 'Testing CONTACT PAGE'; $message = 'Message From your site: Their Name: $senderName Their Email: $senderEmail Their Message is below: $senderMsg'; // Build $headers Variable $headers = 'From: Company <mysite@mydomain.com.com>' . "\r\n"; $to = '$to'; // Send the email mail($to, $subject, $message, $headers); $my_msg='thanks your message has been sent.'; print $my_msg; ?> The error I'm getting is this: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\xampp\htdocs\PHP_Test\email.php on line 5 all I want to be able to do is verify my form works and that I can receive emails from users of mysite any help would be greatly appreciated. Also what should the send_mail in the PHP.INI file be set to? thansk Hello Guys I just want to ask if I will send email using php syntax do I need to configure the php ini settings? Any ideas how to configure it? Your usual cooperation is highly appreaciated. God Bless.. I need some help over here. I want to send an email to my friends by checking the database and extract the id. After extracting the id from the database, i want to include a URL with the id. E.g. www.abc.php?35 (35 is the id) www.abc.php?40 (40 is the id) May I know how to send an email with multiple url? Is it using a for loop in the php email function? Your help is greatly appreciated. this is a forgot password page and this email script will not send Code: [Select] <?php $emailcut = substr($email, 0, 4); // Takes first four characters from the user email address $randNum = rand(); $tempPass = "$emailcut$randNum"; $hashTempPass = md5($tempPass); @mysql_query("UPDATE myMembers SET password='$hashTempPass' where email='$email'") or die("cannot set your new password"); include('Mail.php'); include('Mail/mime.php'); // Constructing the email $sender = "Social network"; // Your email address $recipient = "$email"; // The Recipients name and email address $subject = "Reset Your Password"; // Subject for the email $text = 'This is a text message.'; // Text version of the email $html = "<html><body><div align=center><br>----------------------------- New Login Password --------------------------------<br><br><br> Your New Password for our site is: <font color=\"#006600\"><u>$tempPass</u></font><br><br /> </div></body></html>"; // HTML version of the email $crlf = "\n"; $headers = array( 'From' => $sender, 'Return-Path' => $sender, 'Subject' => $subject ); // Creating the Mime message $mime = new Mail_mime($crlf); // Setting the body of the email $mime->setTXTBody($text); $mime->setHTMLBody($html); // Add an attachment // Set body and headers ready for base mail class $body = $mime->get(); $headers = $mime->headers($headers); // SMTP authentication params $smtp_params["host"] = "smtp.gmail.com"; $smtp_params["port"] = "587"; $smtp_params["auth"] = true; $smtp_params["username"] = "activate.social@gmail.com"; $smtp_params["password"] = "pass"; // Sending the email using smtp $mail =& Mail::factory("smtp", $smtp_params); $result = $mail->send($recipient, $headers, $body); if (PEAR::isError($mail)) { $outputForUser = '<font color="#FF0000">Password Not Sent.<br /><br /> Please Contact Us...</font>'; } else { $outputForUser = "<font color=\"#006600\"><strong>Your New Login password has been emailed to you.</strong></font>"; } } } else { $outputForUser = 'Enter your email address into the field below.'; } ?> Hi, I want to send an email to my registered users so that when they click on the URL given in the message hey should come back to my site as confirmetion of their registration. I am able to send the mail but the mail body is not coming as expected. Here's my code Code: [Select] <?php public function email($id){ //get users info $this->userInfo = $this->model->listUser($id); $this->sendEmail($this->userInfo); } public function sendEmail($data){ $to =$data['email']; $this->msg ="<img src=\"ideas.kpjit.com/public/images/header-img.jpg\" /> <h1>KPJ Idea</h1> <p>Make a difference</p> <p>This is a Confirmation Mail.Please confirm your registration by clicking here <a href=\"http://ideas.kpjit.com\register\confirm\ <?php echo $this->data['id'];?></p>\" "; $subject = "Registration confirmation"; $message = $this->msg; $from ="narjisfatima@yahoo.com"; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From:narjisfatima@yahoo.com' . "\r\n"; if(mail($to,$subject,$headers)){ $this->render2("register/message"); exit; } } Also I am unable to insert my site banner in the mail. How can I do It. I am sending a email verification that a person registers on my site. I have two problems. Here is the email script: Code: [Select] $message = "Thank you for registering."; mail($email, 'Registration Confirmation', $message, 'From: noreply@website.com'); Problem 1: I have tried this on two different identical pages, index.php and register.php. It only works in the index page. Problem 2: When it does work on the index page, the From header does not show what is in the mail() function, it shows that it is from my host. What's up with that? Given the choice, I need to get problem 2 solved way more than problem 1. Thank you. I have been working a a program to send text messages using php but my headers containing the "From:" part of the text message keep on returning an error. Could someone please explain what i'm doing wrong. I have attached the php script and the html page I am using as a form. <?php $from = $_POST['from']; $to = $_POST['to']; $carrier = $_POST['carrier']; $carrierFrom = $_POST['carrierFrom'] $message = stripslashes($_POST['message']); //From Function if ($carrierFrom == "verizon") {$formatted_from = $from."@vtext.com";} if ($carrierFrom == "tmobile") {$formatted_from = $from."@tomomail.net";} if ($carrierFrom == "sprint") {$formatted_from = $from."@messaging.sprintpcs.com";} if ($carrierFrom == "att") { $formatted_from = $from."@txt.att.net"; if ($carrierFrom == "gmail") { $formatted_from = $from."@gmail.com"; } //To Function if ($carrierFrom == "verizon") {$formatted_number = $to."@vtext.com";} if ($carrier == "tmobile") {$formatted_number = $to."@tomomail.net";} if ($carrier == "sprint") {$formatted_number = $to."@messaging.sprintpcs.com";} if ($carrier == "att") {$formatted_number = $to."@txt.att.net";} if ($carrier == "gmail") {$formatted_number = $to."@gmail.com";} //Send $sent = mail($formatted_number,$message,$formattedFrom) ; if($sent) {print "Your text was sent successfully"; } else {print "We encountered an error sending your text"; } ?> Hello, i am not good at php so need some help.I have a php page with check box from where i am trying to send mail to multiple recipient. i can send mail but with little problem. when i select eg. 3 check box to send email then 1st email recipient is ok but 2nd email goes with 1st and 2nd recipient and 3rd email goes 1st,2nd,3rd recipient. i guess having problem with 'foreach'. will someone pls help me to send individual email to individual recipient with my MySQL query's. Here is my code for mail.php page Code: [Select] <?php require_once('auth.php'); ?> <html> <head> <title>PHPMailer - SMTP basic test with authentication</title> </head> <body> <?php include("Connections/connection.php"); //error_reporting(E_ALL); error_reporting(E_STRICT); date_default_timezone_set('Europe/Dublin'); require_once('php_mailer/class.phpmailer.php'); //include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded $mail = new PHPMailer(); //$body = file_get_contents('contents.php'); //$body = eregi_replace("[\]",'',$body); $sender_name = $_SESSION['sender_name']; $sender_email = $_SESSION['sender_email']; $sender_password = $_SESSION['sender_password']; $id_user = $_POST["id_user"]; foreach ($id_tariff as $idt) { $query = sprintf("SELECT From_Date, To_Date, first, last, city, country, Email_1, Email_2, account_name FROM user_info where id_user = $id_user"); $result = mysql_query($query) or die(mysql_error()); $body = " <table width='100%' border='1' cellspacing='0' cellpadding='3' bordercolor='#ffcccc'> <tr> <th bgcolor='#cc3333'>From</th> <th bgcolor='#cc3333'>To</th> <th bgcolor='#cc3333'>First Name</th> <th bgcolor='#cc3333'>Last Name</th> <th bgcolor='#cc3333'>City</th> <th bgcolor='#cc3333'>country</th> </tr> "; while($row = mysql_fetch_array($result)){ $body .="<tr>"; $body .="<td>".$row['From_Date']."</td>"; $body .="<td bgcolor='#FFE8E8'>".$row['To_Date']."</td>"; $body .="<td>".$row['first']."</td>"; $body .="<td bgcolor='#FFE8E8'>".$row['last']."</td>"; $body .="<td>".$row['city']."</td>"; $body .="<td bgcolor='#FFE8E8'>".$row['country']."</td>"; $body .="</tr>"; $to1 = $row['Email_1']; $to2 = $row['Email_2']; $account_name = $row['account_name']; } $body .="</table>"; $mail->IsSMTP(); // telling the class to use SMTP $mail->Host = "smtp.gmail.com"; // SMTP server $mail->SMTPDebug = 1; // enables SMTP debug information (for testing) // 1 = errors and messages // 2 = messages only $mail->SMTPAuth = true; // enable SMTP authentication $mail->SMTPSecure = "ssl"; $mail->Host = "smtp.gmail.com"; // sets the SMTP server $mail->Port = 465; // set the SMTP port for the GMAIL server $mail->Username = "$sender_email"; // SMTP account username $mail->Password = "$sender_password"; // SMTP account password $mail->SetFrom($sender_email,$sender_name); $mail->AddReplyTo("$sender_email","$sender_name"); $mail->Subject = "Hello Dear $account_name"; $mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; $mail->MsgHTML($body); $mail->AddAddress($to1,$account_name); $mail->AddAddress($to2,$account_name); if(!$mail->Send()) { echo "Mailer Error: " . $mail->ErrorInfo; } else { echo "YOUR E-MAIL HAS SENT"; } } ?> </body> </html> Thanks in advance. Hi I need some help. I want to send an email to user to inform them about their next appointment date but I don't know how to do the query. My database look something like this: id | name | email | contact_no | appointment_date 1 Jon jon@abc.com 12345678 24/12/2011 The appointment date is added in by user so it will keep updating to the latest date. <?php include 'config.php'; $sql = executeSelectQuery($MYSQL); if($sql){ $to = $_POST ['email']; $subject = "Appointment Date"; $message = "Hello! Please be informed that your next appointment is on $appointment_date"; $from = "123@abc.com"; $headers = "From: $from"; $sent = mail($to,$subject,$message,$headers); if ($sent){ $statusMessage = "Mail Successfully Sent."; }else{ $statusMessage = "Mail Unsuccessfully Sent"; } ?> Please kindly help. Thanks Ben Hi all I am trying to create a HTML email that send using a PHP script. How do I open the quote and close the PHP tag so I can drop in my HTML code? You can see below my $message string starting and then I have tried to close the PHP tag. Code: [Select] <?php $email = 'do-not-reply@test.co.uk'; $to = 'mail@petenaylor.net'; $subject = "You have received an order from the Website "; $message = ' '?> <html> <body>You have received an order from the Website. <h1>Your Order Total:</h1> <table width="726" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="331" height="39">JH001 AWD College Hoodie</td> <td width="107" align="left">small</td> <td width="40" align="center"><img src="http://www.testsite.com/images/shop/basket-logo-icon.gif" width="30" height="39" alt="You have chosen a logo for this item" /></td> <td width="40" align="center"><img src="http://www.testsite.com/images/shop/embroidery.png" width="30" alt="You have chosen embroidered text for this item" /></td> <td width="40" align="center"><img src="http://www.testsite.com/images/shop/basket-text-icon.gif" width="30" height="39" alt="You have chosen printed text for this item" /></td> <td width="40" align="center"><img src="http://www.testsite.com/images/shop/basket-number-icon.gif" width="30" height="39" alt="You have chosen a printed number for this item" /></td> <td width="40" align="center"><img src="http://www.testsite.com/images/shop/special1.gif" width="30" height="30" alt="You have chosen special offer 1 for this item" /></td> <td width="40" align="center"><img src="http://www.testsite.com/images/shop/special2.gif" width="30" height="30" alt="You have chosen special offer 2 for this item" /></td> <td width="48" align="center">£ 13.99</td> </tr> </table> </body> </html> <?php ' '; // To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= "From: ".$email."\n" . "Reply-To: ".$email."\n"; // Mail it mail($to, $subject, $message, $headers); Many thanks for your help Pete I have tried the top 4 or 5 scripts from googling "send html email using php." Every single one results in the html markup itself being displayed as text, not as a styled page. I have many emails from companies where no matter what client I view it on I see a fully styled webpage with links and pics. How can this be achieved with php? |