PHP - Mail() Sending Images, Question Mark In Iphone Mail. Works In Regular Mail
I have a notification system that notifies users of new comments, inside the email I have images, some of the logo, some of different people, everything shows up fine on my computer (yahoo email), however in the iPhones email application no images show up, there are just the blue squares with the question marks in them. I'm not sure what I'm missing.
Code: [Select] $from = "Kithell <notifications@kithell.com>"; $headers = "From:" . $from ."\r\n"; $headers .= 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $subject = name($from_id, 'fl').$action; $message = '<html><body> <style>@charset "utf-8"; /* CSS Document */ .e-container { background-color: #FFF;position: relative;width: 90%;min-height:1px;margin-right: auto;margin-left: auto; } .e-container .e-m-header { padding: 2px; background-image: url(http://www.kithell.com/assets/tall-grey-header.png); background-repeat: repeat-x; border: 1px solid #CCC; background-position: bottom; display: block; text-align: center; } .e-container p { font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-weight: normal; color: #666; vertical-align: text-top; display: inline-block; } .e-container .e-usr-photo { display: inline-block; margin: 10px; float: left; background-color: #F4F4F4; } .e-container p a { font-weight: bold; color: #3F60A3; text-decoration: underline; padding: 0px; float: left; margin-top: 0px; margin-right: 5px; margin-bottom: 0px; margin-left: 0px; } .e-container .e-quotes { font-size: 20px; font-weight: bold; color: #999; font-family: Tahoma, Geneva, sans-serif; display: block; padding: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 75px; margin-top:10px; } .e-container .e-message { font-size: 13px; color: #333; padding: 0px; margin-top: 0px; margin-right: 10px; margin-bottom: 0px; margin-left: 10px; clear: none; display: inline; }</style> <div class="e-container"><div class="e-m-header"><img src="http://www.kithell.com/assets/kithell-logo.png" /></div><img class="e-usr-photo" src="http://www.kithell.com/'.photo($from_id, 55).'" /><br /><p><a target="_blank" href="http://www.kithell.com/#/profile&id='.$from_id.'">'.name($from_id, "fl").' </a> '.$action.'<div class="e-quotes">"<p class="e-message">'.nl2br(htmlentities(stripslashes($message))).'</p>"</div></p></div></body></html>'; mail($to,$subject,$message,$headers); Similar TutorialsI'm setting up a newsletter thing for my website. I have a newsletter table in MySQL: Quote +----------------+------+--------+ | email | mens | womens | +----------------+------+--------+ | test2@test.com | 1 | 1 | | test1@test.com | 1 | 0 | +----------------+------+--------+ I am using a HTML form and this PHP code I learn't from the manual, which sends out e-mail's. PHP: if ($_POST['newsletter'] == 'Mens') { $to = ''; $subject = $_POST['subject']; $body = $_POST['body']; $header = 'From: Me Someone <me@someone.com>'; mail($to, $subject, $body, $header); } What I want to do with the above code is send out an e-mail to all the e-mails in my MySQL database that are tagged '1' under mens. How would I go about doing this? I'm guessing I will have to use a MySQL query in the $to = ''; that goes something like this: $to = '$query (select from `newsletters` where `email` = 1'); ? Hello to all out there! this is my first post,so my question may sound a bit simple. :] I am studying PHP and MySQL and I tried to make a mailing form based on a mysql database. My problem occured when I tried to use the PEAR mail object. Here is my code: // THE INCLUDED FILES require_once ("attach_file.php" ); require_once ("Mail.php" ); require_once ("Mail\mime.php" ); //THE VARIABLES TAKEN FROM THE HTML FORM OR JUST CREATED FOR THE CONSTRUCTION OF THE EMAIL $my_email = "something@gmail.com"; $email_subject = mysql_real_escape_string(trim( $_POST['email_subject']),$server_connect ); $email_body = mysql_real_escape_string(trim( $_POST['email_body'] ),$server_connect ); $attached_file = $destination ; // the $destination variable comes from the copy() function in attach_file.php $username = "the_username@gmail.com"; $password = "the_password"; $host = "smtp.gmail.com"; $attach = new Mail_mime(); $attach -> addAttachment($attached_file); $email_body = $attach->get(); $extraheaders = array('from'=>$my_email,'to'=>$email_etaireias,'subject'=>$email_subject,'Bcc'=>$email_etaireias); $headers = $attach -> $headers($extraheaders); // HERE GIVES ME AN ERROR!!! -->Fatal error: Method name must be a string $smtp_info = array('host'=>$host,'auth'=>TRUE,'username'=>$username,'password'=>$password); $smtp = Mail::factory('smtp',$smtp_info); //loop through every single line of the database until there are no more lines with data //and store each line in 3 different variables that i can use while ( $row = mysql_fetch_array($result) ) { $onoma_etaireias = $row['onoma_etaireias']; $email_etaireias = $row['email_etaireias']; $website_etaireias = $row['website_etaireias']; } //construct the mail function . The @ is supressing the errors created .remove it and they will be shown. $mail = @$smtp->send($email_etaireias,$headers,$email_body); As i searched here and there for a solution, i found that it has something to do with the way the mail-mime object creates the body of the email . I also tried to find a solution from the PEAR documentation. do i create the headers someway wrong????? This topic has been moved to Other Web Server Software. http://www.phpfreaks.com/forums/index.php?topic=347009.0 system: vista ultimate sp2 IIS 7 server installed and running PHP 5 fastCGI im not sure if this is within the purview of the forum but you all seem like smart people with an expertise in this area. i have a web site http://penumbraproductions.dyndns-remote.com/ . it is hosted locally on my desktop using the above mentioned IIS7 server options using dyndns to list the url cause my ISP has DHCP without static ip's for non-business accounts that has a contact form... form mail. i've tried numerous php codes to get it to send mail to my email account but none of them are working my IIS smtp setting a email to: archaismic@gmail.com smtp server: smtp.gmail.com port number: 465 using login credentials i've also tried to configuring the smtp options in IIS to dump the mail to a folder on my computer which also did not work attached is the feedback.php file im currently working with minus the captcha private key and the code for the form i'm using is: Code: [Select] <form action="feedback.php" method="post"> <table border="0" cellpadding="8" cellspacing="8"> <tr><td><label for="tswname">Name</label>:</td><td><input type="text" name="fullname" id="tswname" size="25" /></td></tr> <tr><td><label for="tswemail">Email address</label>:</td><td><input type="text" id="tswemail" name="email" size="25" /></td></tr> <tr> <td colspan="2"> <label for="tswcomments">Comments</label><br /> <textarea rows="15" cols="45" name="comments" id="tswcomments"></textarea> </td> </tr> <tr> <td align="center" colspan="2"> <script type="text/javascript" src="http://api.recaptcha.net/challenge?k=6LcYjcASAAAAAH1NwZ0IH_TUO4XDANZqWu3Ei9yh"></script> <noscript> <iframe src="http://api.recaptcha.net/noscript?k=6LcYjcASAAAAAH1NwZ0IH_TUO4XDANZqWu3Ei9yh" height="300" width="500" frameborder="0" title="CAPTCHA test"></iframe> <br /> <label for="tswcaptcha">Copy and paste the code provided in above box he </label><br /> <textarea name="recaptcha_challenge_field" id="tswcaptcha" rows="3" cols="40"></textarea> <input type="hidden" name="recaptcha_response_field" value="manual_challenge" /> </noscript> </td> </tr> <tr> <td align="center" colspan="2"> <input type="submit" value="Send Feedback" /> </td> </tr> </table> </form> Hello Everyone I have written a simple mail function to be emailed to a certain person on submission. On submission they would also like to have attachments sent to them. I got the email being sent but I can;t get the attachments to work. I have read several different examples and tutorials and none of them work. This is my code so far without any code for file attachment <?php $project_name = $_POST['project_name']; $needed = $_POST['date_needed']; $submitted = $_POST['date_submitted']; $department = $_POST['department']; $contact = $_POST['contact_person']; $extension = $_POST['extension']; $project_type = $_POST['project_type']; $published = $_POST['date_last_published']; $description = $_POST['description']; $color = $_POST['color']; $pdf = $_POST['pdf_needed']; $web = $_POST['web_needed']; $quanity = $_POST['quanity']; $email = "mdmartiny@sc4.edu"; $subject = "SC4 Graphics Design Service Request Form"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; $message = "<html><body> <table width=\"100%\" border=\"0\" cellspacing=\"5px\" > <tr><td></td> <td>Project name: $project_name</td> <td></td> <td>Date needed by: $needed</td> </tr> <tr> <tr> <td></td> <td colspan=\"3\" align=\"left\" valign=\"top\"><strong><font size=\"+1\">Submitted to graphic designer</font></strong></td></tr> <tr><td height=\"25\"></td><td>Date $submitted</td><td>Department $department</td><td></td></tr> <tr><td height=\"25\"></td><td>Contact Person $contact</td><td>Extension $extension</td><td></tr> <tr><td height=\"25\"></td><td>Type of project $project_type</td><td colspan=\"2\">Approximate date of last publication $published</td></tr> <tr><td height=\"25\"></td><td colspan=\"3\">Project description/special instructions</td> <tr><td></td>><td colspan=\"3\">$description</td></tr> <tr><td height=\"25\"></td><td>Color $color</td><td>PDF needed $pdf</td><td>Website update needed $web</td></tr> <tr><td ></td><td>Estimated print quanity $quanity</td><td></td><td></td></tr> <tr> <td colspan=\"4\" align=\"left\" valign=\"top\"><hr height=\"5\"/> <strong><font size=\"+1\">Graphics office use only</font></strong></td> </tr> <tr> <td height=\"25\" width=\"2%\"> </td> <td width=\"34%\">Print Shop Color copier</td> <td colspan=\"2\">Print Vendor_______________________________________</td> </tr> <tr> <td height=\"25\"> </td> <td><strong><font size=\"+1\">Project tracking</font></strong></td> <td> </td> <td> </td> </tr> <tr> <td height=\"25\"> </td> <td colspan=\"3\">Received by graphic designer_______________________ Date _______</td> </tr> <tr> <td height=\"25\"> </td> <td colspan=\"3\"> <table width=\"100%\" height=\"35\"> <tr> <td>Approved by executive director__________ Date_________</td><td><input type=\"checkbox\"> Revisions needed<br /><input type=\"checkbox\"> Revisions made ______ Date_______</td><tr> </table> </td> </tr> <tr> <td height=\"25\"> </td> <td colspan=\"3\">Completed and spell checked by graphic designer___________________________ Date__________</td> </tr> <tr> <td> </td> <td align=\"center\" colspan=\"3\"> <table cellpadding=\"10px\" cellspacing=\"0\" border=\"1\" width=\"100%\"> <tr bgcolor=\"#CCCCCC\"> <td> <table> <tr> <td> Proofread by marketing coordinator __________ Date__________</td> </tr> <tr> <td> Proofread by secretary __________ Date__________ </td> </tr> </table> </td> <td> <input type=\"checkbox\"> Revisions needed <br> <input type=\"checkbox\"> Revisions made ____ Date_____ </td> </tr> </table></td> </tr> <tr> <td></td> <td colspan=\"3\"> <table width=\"100%\" height=\"75\"> <tr> <td>Proofread by executive director______ Date______ </td><td><input type=\"checkbox\"> Revisions needed<br /> <input type=\"checkbox\"> Revisions made ______ Date_______</td> </tr> </table> </td> </tr> <tr> <td></td> <td colspan=\"3\"> <table width=\"100%\" height=\"75\"> <tr> <td> Approval by requesting department __________ Date_________ <br /> <strong><font size=\"-1\">(Include all paperwork when returning)</font></strong></td><td><input type=\"checkbox\"> Revisions needed<br /><input type=\"checkbox\"> Revisions made ______ Date_______</td> </tr> </table> </td> </tr> <td></td height=\"25\"> <td colspan=\"3\">Final approval by executive director _________________________________________ Date_________ </td> </tr> <tr> <td height=\"75\"></td> <td><input type=\"checkbox\"> Printed ____ Date _____</td> <td colspan=\"2\"><input type=\"checkbox\"> PDF created _____ Date _____<br /> <input type=\"checkbox\"> Website updated _____ Date _____</td> </tr> </table>"; $message .= "</body></html>"; mail($email, $subject, $message, $headers, "From: $email"); echo "The email has been sent."; ?> $to=sammieave@ave.com,samuel@ave.com; $subject = "New Event Logged"; $message = "Test"; $headers = "From: Samuel<sammieave@ave.com>;\r\n"; $headers .= "Content-Type: text/html"; mail($to,$subject,$message,$headers); I am having the above code but unfortunately the error I am getting is: Warning: mail() [function.mail]: SMTP server response: 550 Requested action not taken: mailbox unavailable or not local in C:\xampp\htdocs\CRM\support\mailer.php on line 139 I am using magento for sending mail with condition, My code: <?php class Gta_MerchantNotification_Model_Observer { public function merchantremainder($Observer) { $order = $Observer->getEvent()->getOrder(); $order_details = $order->getAllVisibleItems(); $itemData = array(); foreach ($order_details as $list) { $incrementid = $order->getIncrementId(); $sku = $list->getsku(); $name = $list->getName(); $price = $list->getPrice(); $Qty = $list->getQtyOrdered(); $extra = $order->getIncrementId(); $message = " <tr> <!-- <td>$incrementid</td> --> <td>$sku</td> <td>$name</td> <td>$price</td> <td>$Qty</td> </tr>"; $itemData[$list->getId()] = $message; } $finalMessage = " <p>Order Id : $incrementid</p> <table border='1'> <tr> <!-- <th>Id</th> --> <th>Sku</th> <th>Product name</th> <th>Price</th> <th>Qty Ordered</th> </tr>"; if (!empty($itemData)) { foreach ($itemData as $data) { $finalMessage .= $data; } $finalMessage .= "</table>"; $this->sendMail($finalMessage); } } public function sendMail($message) { $body ="$message"; $emailTemplate = Mage::getModel('core/email'); $emailTemplate->setFromName('abc'); $emailTemplate->setBody($body); $emailTemplate->setSubject("Custom Email from observer"); $emailTemplate->setType('html'); $emailTemplate->setToEmail('abc@gmail.com'); $emailTemplate->send(); } } ?>
Output :
If order placed mail send to abc@gmail.com. I want :
1) If SKU starts with 2, email should go to the mail id abc@gmail.com,
2) If SKU starts with 3, email should go to the mail id xyz@gmail.com,
3) If SKU starts with 4, email should go to the mail id qwe@gmail.com,
FYI - If an order contains 10 items email should go separately based on SKU. But an order id the same must include all the emails.
Hello there, I've come across a issue with using PHP's mail function due to the fact I've tried a assortment of different headers yet Hotmail continues to place my sent emails in the junk folder. Here is my method of emailing my clients: function Email($AccountID, $Subject, $Message) { if($this->IsValidAccount($AccountID)) { $Account = $this->AccountKeys($AccountID); $headers .= 'To: '.$Account['account_client'].' <'.$Account['account_email'].'>' . "\r\n"; $headers .= "From: X-Host <no-reply@X-Host.co.uk>\r\n"; $headers .= "Reply-To: X-Host <no-reply@X-Host.co.uk>\r\n"; $headers .= "Return-Path: no-reply@X-Host.co.uk\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; $headers .= "Organization: X-Host\r\n"; echo $Account['account_email']. $Subject. $Message; return mail($Account['account_email'], $Subject, $Message, $headers); } else return InvalidAccount; } So could anybody help me out please and tell me what headers I should be using. Hi all, I'm coding an automated mailer for a dentist office. They set appointment dates through a web interface, and then this appointment is mailed to the customer via PHP's mail() function. However, some users are not receving the mail. They claim that it is not even in the junk mail folder. Is it because I'm setting or not setting certain properties in the header? Should I be setting something else? Here is my code Code: [Select] ini_set("SMTP", "mail.isp-provider.net"); $headers = 'From: Schedule Manager <schedule@address.com>' . "\r\n" . 'Reply-To: Schedule Manager <schedule@address.com>' . "\r\n" . 'Bcc: internal@address.com' . "\r\n" . 'Content-type: text/html; charset=iso-8859-1' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($customerAddress, $subject, $body, $headers); Note that customerAddress, subject, and body are all just regular normal strings. As I said, it works for most customers, but some customers do not receive the emails. From 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; Hi, I found a couple of topics in the search on this but can't resolve my problem. I have a cart and want to mail it to myself and the client. The cart I'm using works fine but the moment I "check out" (mail the order) it gives a error. I build an error trap but see nothing wrong then I tried a different way to send the order in html with no avail. 6x files I use: Index.php -The products I'm selling and "add to chart" Cart.php - To update and display the products in the basket SendOrder.php - To mail the cart etc. to me and client as the main files and some functions, db connection and global's... 1) Index.php by Simon Mayer <?php // Start the session session_start(); // Include MySQL class require_once('inc/mysql.class.php'); // Include database connection require_once('inc/global.inc.php'); // Include functions require_once('inc/functions.inc.php'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>MedSET Store</title> <link rel="stylesheet" href="css/styles.css" > </head> <body> <div id="shoppingcart"> <h1>Your Shopping Cart</h1> <?php echo writeShoppingCart(); ?> </div> <div id="booklist"> <h1>Products</h1> <?php $sql = 'SELECT * FROM books ORDER BY id'; $result = $db->query($sql); $output[] = '<ul>'; while ($row = $result->fetch()) { $output[] = '<li>"'.$row['title'].'" by '.$row['author'].': £'.$row['price'].'<br /><a href="cart.php?action=add&id='.$row['id'].'">Add to cart</a></li>'; } $output[] = '</ul>'; echo join('',$output); ?> </div> </body> </html> 2)Cart.php by Simon Mayer <?php // Start the session session_start(); // Include MySQL class require_once('inc/mysql.class.php'); // Include database connection require_once('inc/global.inc.php'); // Include functions require_once('inc/functions.inc.php'); // Process actions $cart = $_SESSION['cart']; $action = $_GET['action']; switch ($action) { case 'add': if ($cart) { $cart .= ','.$_GET['id']; } else { $cart = $_GET['id']; } break; case 'delete': if ($cart) { $items = explode(',',$cart); $newcart = ''; foreach ($items as $item) { if ($_GET['id'] != $item) { if ($newcart != '') { $newcart .= ','.$item; } else { $newcart = $item; } } } $cart = $newcart; } break; case 'update': if ($cart) { $newcart = ''; foreach ($_POST as $key=>$value) { if (stristr($key,'qty')) { $id = str_replace('qty','',$key); $items = ($newcart != '') ? explode(',',$newcart) : explode(',',$cart); $newcart = ''; foreach ($items as $item) { if ($id != $item) { if ($newcart != '') { $newcart .= ','.$item; } else { $newcart = $item; } } } for ($i=1;$i<=$value;$i++) { if ($newcart != '') { $newcart .= ','.$id; } else { $newcart = $id; } } } } } $cart = $newcart; break; } $_SESSION['cart'] = $cart; ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>MedSET Store</title> <link rel="stylesheet" href="css/styles.css" > </head> <body> <div id="shoppingcart"> <h1>Your Shopping Cart</h1> <?php echo writeShoppingCart(); ?> </div> <div id="contents"> <h1>Please check quantities...</h1> <?php echo showCart(); ?> <form action="sendOrder.php" method="post"> //I added the action file to handle the form <input type="submit" name="sendmail" value="Check Out" > </form> <p><a href="index.php">Continue Shopping...</a></p> </div> </body> </html> 2.1)MySQL.class.php <?php /** * MySQL Database Connection Class * @access public * @package SPLIB */ class MySQL { /** * MySQL server hostname * @access private * @var string */ var $host; /** * MySQL username * @access private * @var string */ var $dbUser; /** * MySQL user's password * @access private * @var string */ var $dbPass; /** * Name of database to use * @access private * @var string */ var $dbName; /** * MySQL Resource link identifier stored here * @access private * @var string */ var $dbConn; /** * Stores error messages for connection errors * @access private * @var string */ var $connectError; /** * MySQL constructor * @param string host (MySQL server hostname) * @param string dbUser (MySQL User Name) * @param string dbPass (MySQL User Password) * @param string dbName (Database to select) * @access public */ function MySQL ($host,$dbUser,$dbPass,$dbName) { $this->host=$host; $this->dbUser=$dbUser; $this->dbPass=$dbPass; $this->dbName=$dbName; $this->connectToDb(); } /** * Establishes connection to MySQL and selects a database * @return void * @access private */ function connectToDb () { // Make connection to MySQL server if (!$this->dbConn = @mysql_connect($this->host, $this->dbUser, $this->dbPass)) { trigger_error('Could not connect to server'); $this->connectError=true; // Select database } else if ( !@mysql_select_db($this->dbName,$this->dbConn) ) { trigger_error('Could not select database'); $this->connectError=true; } } /** * Checks for MySQL errors * @return boolean * @access public */ function isError () { if ( $this->connectError ) return true; $error=mysql_error ($this->dbConn); if ( empty ($error) ) return false; else return true; } /** * Returns an instance of MySQLResult to fetch rows with * @param $sql string the database query to run * @return MySQLResult * @access public */ function query($sql) { if (!$queryResource=mysql_query($sql,$this->dbConn)) trigger_error ('Query failed: '.mysql_error($this->dbConn). ' SQL: '.$sql); return new MySQLResult($this,$queryResource); } } /** * MySQLResult Data Fetching Class * @access public * @package SPLIB */ class MySQLResult { /** * Instance of MySQL providing database connection * @access private * @var MySQL */ var $mysql; /** * Query resource * @access private * @var resource */ var $query; /** * MySQLResult constructor * @param object mysql (instance of MySQL class) * @param resource query (MySQL query resource) * @access public */ function MySQLResult(& $mysql,$query) { $this->mysql=& $mysql; $this->query=$query; } /** * Fetches a row from the result * @return array * @access public */ function fetch () { if ( $row=mysql_fetch_array($this->query,MYSQL_ASSOC) ) { return $row; } else if ( $this->size() > 0 ) { mysql_data_seek($this->query,0); return false; } else { return false; } } /** * Returns the number of rows selected * @return int * @access public */ function size () { return mysql_num_rows($this->query); } /** * Returns the ID of the last row inserted * @return int * @access public */ function insertID () { return mysql_insert_id($this->mysql->dbConn); } /** * Checks for MySQL errors * @return boolean * @access public */ function isError () { return $this->mysql->isError(); } } ?> 2.2)Global.inc.php <?php $host = 'localhost'; $user = 'MyUserName'; $pass = 'MyPassword'; $name = 'MyDataBase'; $db = &new MySQL($host,$user,$pass,$name); ?> 2.3)Function.inc.php <?php function writeShoppingCart() { $cart = $_SESSION['cart']; if (!$cart) { return '<p>You have no items in your shopping cart</p>'; } else { // Parse the cart session variable $items = explode(',',$cart); $s = (count($items) > 1) ? 's':''; return '<p>You have <a href="cart.php">'.count($items).' item'.$s.' in your shopping cart</a></p>'; } } function showCart() { global $db; $cart = $_SESSION['cart']; if ($cart) { $items = explode(',',$cart); $contents = array(); foreach ($items as $item) { $contents[$item] = (isset($contents[$item])) ? $contents[$item] + 1 : 1; } $output[] = '<form action="cart.php?action=update" method="post" id="cart">'; $output[] = '<table>'; foreach ($contents as $id=>$qty) { $sql = 'SELECT * FROM books WHERE id = '.$id; $result = $db->query($sql); $row = $result->fetch(); extract($row); $output[] = '<tr>'; $output[] = '<td><a href="cart.php?action=delete&id='.$id.'" class="r">Remove</a></td>'; $output[] = '<td>'.$title.' by '.$author.'</td>'; $output[] = '<td>£'.$price.'</td>'; $output[] = '<td><input type="text" name="qty'.$id.'" value="'.$qty.'" size="3" maxlength="3" /></td>'; $output[] = '<td>£'.($price * $qty).'</td>'; $total += $price * $qty; $output[] = '</tr>'; } $output[] = '</table>'; $output[] = '<p>Grand total: <strong>£'.$total.'</strong></p>'; $output[] = '<div><button type="submit">Update cart</button></div>'; $output[] = '</form>'; } else { $output[] = '<p>You shopping cart is empty.</p>'; } return join('',$output); } ?> 3)SendOrder.php <?php $cart = $_SESSION['cart']; $to = "me@myself.com"; $subject = "MedSET Order"; $message = "<html> <head> <title>Email Order<Title> </head> <body> This is my message in body </body>"; $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n"; $headers .= 'From: "email address" <an email existing on same server as shopping cart>' . "\r\n"; mail($to, $subject,$message,$headers,$cart); ?> Any help will be appreciated... Alright, been having a problem with some websites lately. The host is GoDaddy (I know, I know...). <!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>Horticultural Service | Landscape Consultant | W. Florida Panhandle | Landscaping</Title> <META NAME="Author" CONTENT="Horticultural Service Group"> <META NAME="Subject" CONTENT="Horticultural Service Group offering landscape consulting and Horticultural pruning and trimming."> <META NAME="Description" CONTENT="Horticultural Service company serving the W. Florida Panhandle region. Offering landscape consulting service and horticultural correct pruning of trees and bushes. Residential landscaping, tree trimming and consulting service."> <META NAME="Keywords" CONTENT="horticultural service,horticulture, pruning,tree pruning,pruning plants,pruning bushes,tree trimming,landscaping, landscaping yards,residential landscaping,landscape architecture, backyard landscape,W. Florida Panhandle,FL panhandle"> <META NAME="Language" CONTENT="English"> <META NAME="Copyright" CONTENT="© Horticultural Service Group"> <META NAME="Revisit-After" CONTENT="15 Days"> <META NAME="Distribution" CONTENT="Global"> <META NAME="Robots" CONTENT="Follow, All"> <link href="css/style.css" rel="stylesheet" type="text/css" /> <script type="text/javascript"> <!-- function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; } function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} } function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x; } function MM_swapImage() { //v3.0 var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} } //--> </script> <!--=========================================================== Script: JavaScript Cross-Browser SlideShow Script With Cross-Fade Effect between Images Adjustable Timing and Unlimited Images Function: Displays images continuously in a slideshow presentation format, with a fade effect on image transitions. Browsers: All common browsers: NS3-6, IE 4-6 Fade effect only in IE; others degrade gracefully Author: etLux =========================================================== Step 1. Put the following script in the head of your page:--> <script> // (C) 2000 www.CodeLifter.com // http://www.codelifter.com // Free for all users, but leave in this header // NS4-6,IE4-6 // Fade effect only in IE; degrades gracefully // ======================================= // set the following variables // ======================================= // Set slideShowSpeed (milliseconds) var slideShowSpeed = 5000 // Duration of crossfade (seconds) var crossFadeDuration = 3 // Specify the image files var Pic = new Array() // don't touch this // to add more images, just continue // the pattern, adding to the array below Pic[0] = 'images/image_six.jpg' Pic[1] = 'images/image_two.jpg' Pic[2] = 'images/image_one.jpg' Pic[3] = 'images/image_seven.jpg' Pic[4] = 'images/image_eight.jpg' Pic[5] = 'images/image_nine.jpg' // ======================================= // do not edit anything below this line // ======================================= var t var j = 0 var p = Pic.length var preLoad = new Array() for (i = 0; i < p; i++){ preLoad[i] = new Image() preLoad[i].src = Pic[i] } function runSlideShow(){ if (document.all){ document.images.SlideShow.style.filter="blendTrans(duration=2)" document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)" document.images.SlideShow.filters.blendTrans.Apply() } document.images.SlideShow.src = preLoad[j].src if (document.all){ document.images.SlideShow.filters.blendTrans.Play() } j = j + 1 if (j > (p-1)) j=0 t = setTimeout('runSlideShow()', slideShowSpeed) } </script> <script type="text/javascript" src="js/validate.js"></script> </head> <body onload="MM_preloadImages('images/title_home_b.jpg','images/title_about_b.jpg','images/title_gallery_b.jpg','images/title_landscape_b.jpg','images/title_services_b.jpg','images/title_contact_b.jpg'), runSlideShow()"> <div align="center"> <table width="909" border="0" cellspacing="0" cellpadding="0"> <tr> <td colspan="3" align="center" valign="bottom"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td colspan="2"><img src="images/header_top.jpg" alt="Horticultural Services Inc." width="909" height="98" longdesc="index.html" /></td> </tr> <tr> <td width="602" align="left"><img src="images/header_left.jpg" alt="Horticulture Services Group Inc.Inc." width="602" height="185" longdesc="about.html" /></td> <td align="left"><img src="images/image_six.jpg" alt="Landschaft" name="SlideShow" width="308" height="185" id="SlideShow" longdesc="index.html" /></td> </tr> </table></td> </tr> <tr> <td width="81" height="29"><span class="buttoms_left"><img src="images/buttoms_left.jpg" width="81" height="29" /></span></td> <td width="474" align="right" bgcolor="#424242"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="56"><a href="index.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Home','','images/title_home_b.jpg',1)"><img src="images/title_home.jpg" alt="Home" name="Home" width="56" height="29" border="0" id="Home" /></a></td> <td width="75"><a href="about.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('About Us','','images/title_about_b.jpg',1)"><img src="images/title_about.jpg" alt="About Us" name="About Us" width="75" height="29" border="0" id="About Us" /></a></td> <td width="63"><a href="gallery.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Gallery','','images/title_gallery_b.jpg',1)"><img src="images/title_gallery.jpg" alt="Gallery" name="Gallery" width="63" height="29" border="0" id="Gallery" /></a></td> <td width="125"><a href="wordpress/index.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Landscape News','','images/title_landscape_b.jpg',1)"><img src="images/title_landscape.jpg" alt="Landscape News" name="Landscape News" width="125" height="29" border="0" id="Landscape News" /></a></td> <td width="71"><a href="services.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Services','','images/title_services_b.jpg',1)"><img src="images/title_services.jpg" alt="Services" name="Services" width="71" height="29" border="0" id="Services" /></a></td> <td align="left"><a href="contact.php"><img src="images/title_contact_b.jpg" alt="Contact" name="Contact" width="83" height="29" border="0" id="Contact" /></a></td> </tr> </table></td> <td width="354" align="right"><span class="buttoms_right"><img src="images/buttoms_right.jpg" width="354" height="29" /></span></td> </tr> <tr> <td height="46" colspan="3" class="bottom_header"> </td> </tr> </table> <table width="909" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="63" height="426" class="flowers_left"> </td> <td align="center" valign="top" class="content_repeat"><table width="725" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="420" align="left" valign="top" class="content_center"><h1><img src="images/titles_contact_us.jpg" alt="Contact Us" width="120" height="17" longdesc="index.html" /></h1> <? if(isset($_GET['q'])){ $error = explode(';',urldecode($_GET['q']));?> <p class="style1"> <? foreach ($error as $mensaje){ ?> <? echo $mensaje .'<BR>'; }?> </p> <? }?> <h2>Contact Form:</h2> <p>Please fill out the information below and a representative will contact you.</p> <form name="contactForm" id="contactForm" action="sendmail.php" method="post" onSubmit="return validate();"> <label>First Name:*<br /> <input name="fname" type="text" id="fname" style="border:1px solid #5E748C;" size="25" /> </label> <br /> <br /> <label>Last Name:*<br /> <input name="lname" type="text" id="lname" style="border:1px solid #5E748C;" size="25" /> </label> <br /> <br /> <label>Address:<br /> <input name="address" type="text" id="address" style="border:1px solid #5E748C;" size="25" /> </label> <br /> <br /> <label>City:<br /> <input name="city" type="text" id="city" style="border:1px solid #5E748C;" size="25" /> </label> <br /> <br /> <label>State:<br /> <select name="state" tabindex="4" id="state" style="border:1px solid #5E748C;"> <option value="" selected>Choose a State</option> <option value="AL">Alabama</option> <option value="AK">Alaska</option> <option value="AZ">Arizona</option> <option value="AR">Arkansas</option> <option value="CA">California</option> <option value="CO">Colorado</option> <option value="CT">Connecticut</option> <option value="DC">D.C.</option> <option value="DE">Delaware</option> <option value="FL">Florida</option> <option value="GA">Georgia</option> <option value="HI">Hawaii</option> <option value="ID">Idaho</option> <option value="IL">Illinois</option> <option value="IN">Indiana</option> <option value="IA">Iowa</option> <option value="KS">Kansas</option> <option value="KY">Kentucky</option> <option value="LA">Louisiana</option> <option value="ME">Maine</option> <option value="MD">Maryland</option> <option value="MA">Massachusetts</option> <option value="MI">Michigan</option> <option value="MN">Minnesota</option> <option value="MS">Mississippi</option> <option value="MO">Missouri</option> <option value="MT">Montana</option> <option value="NE">Nebraska</option> <option value="NV">Nevada</option> <option value="NH">New Hampshire</option> <option value="NJ">New Jersey</option> <option value="NM">New Mexico</option> <option value="NY">New York</option> <option value="NC">North Carolina</option> <option value="ND">North Dakota</option> <option value="OH">Ohio</option> <option value="OK">Oklahoma</option> <option value="OR">Oregon</option> <option value="PA">Pennsylvania</option> <option value="RI">Rhode Island</option> <option value="SC">South Carolina</option> <option value="SD">South Dakota</option> <option value="TN">Tennessee</option> <option value="TX">Texas</option> <option value="UT">Utah</option> <option value="VT">Vermont</option> <option value="VA">Virginia</option> <option value="WA">Washington</option> <option value="WV">West Virginia</option> <option value="WI">Wisconsin</option> <option value="WY">Wyoming</option> </select> </label> <br /> <br /> <label>Zip:<br /> <input name="zip" type="text" id="zip" style="border:1px solid #5E748C;" size="25" /> </label> <br /> <br /> <label>Email:<br /> <input name="email" type="text" id="email" style="border:1px solid #5E748C;" size="25" /> </label> <br /> <br /> <label>Phone Number:*<br /> <input name="phone" type="text" id="phone" style="border:1px solid #5E748C;" size="25" /> </label> <br /> <br /> <label>Contact Method:<br /> <select name="metod" tabindex="4" id="metod" style="border:1px solid #5E748C;"> <option value="Telephone" selected>Telephone</option> <option value="Email">Email</option> </select> </label> <br /> <br /> <label>Questions or Comments:<br /> <textarea name="comments" cols="40" rows="5" wrap="virtual" id="comments" style="border:1px solid #5E748C;"></textarea> </label> <br /> <br /> <p>*Required Fields</p> <label> <input type="reset" style="border:1px solid #5E748C; background-color:#99CCFF; color:414141;" name="Reset" id="button" value="Reset" /> </label> <label> <input name="submit" style="border:1px solid #5E748C; background-color:#99CCFF; color:414141;" type="submit" value="Send"/> </label> </form> <br /> <div class="line"></div> <h2>Offices:</h2> <p align="center"><b>Horticultural Services Group, Inc.</b><br /> <b>Phone:</b> 850-603-9783<br /> <b>Fax:</b> 800-521-4213<br /> <b>Email:</b> <a href="mailto:slarue@hortservicesgroup.com">slarue@hortservicesgroup.com</a></p> <div align="center"> <!-- form should mail to jwclairmont@register.com --> </div></td> <td width="215" align="center" valign="top"> <h1>850-603-9783</h1><div align="right"><h2>Services we Offer:</h2> <p class="side_services"> <a href="commercial.html" title="commercial services">Commercial Landscape Maintenance</a><br/> <a href="commercial-landscape-design.html" title="commercial landscape design/build">Commercial Landscape Design/Build</a><br/> <a href="residential.html" title="residential services">Residential Landscape Design</a><br/> <a href="residential.html" title="residential services">Home Landscape Renovation</a><br/> <a href="residential.html" title="residential services">Landscape Construction</a><br/> <a href="commercial.html" title="commercial services">Palm Trees</a><br/> <a href="commercial.html" title="commercial services">Tree Installation</a><br/> <a href="commercial.html" title="commercial services">Fertilizer</a></p> </div> <a href="sign_up.php"><img src="images/subscribe_link.jpg" border="0" /></a><br /><br /> <img src="images/image_nature.jpg" alt="Nature" width="194" height="195" longdesc="index.html" /> <p><span class="highlighted">Horticultural Services Group</span><br /> Phone: <b>850-603-9783</b><br /> Fax: <b>800-521-4213</b></p> <p><a href="organizations.html"><strong>Organizations</strong></a></p> <p><a href="http://www.facebook.com/pages/Crestview-FL/Horticulture-Services-Group-Inc/126426941305?ref=ts" target="_blank"><img src="images/facebook.jpg" border="0" /></a></p></td> </tr> </table></td> <td width="51" height="426" class="flowers_right"> </td> </tr> </table> <table width="909" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="69" align="center" valign="top" class="footer"> <a href="index.html">Home</a> | <a href="about.html">About Us</a> | <a href="gallery">Gallery</a> | <a href="wordpress/index.php">Landscape Blog</a> | <a href="contact.php">Contact Us</a> | <a href="wordpress/wp-admin/index.php" style="text-decoration:underline;"><i>Panel Access Management</i></a><br /> <span id="footer">Copyright ©Horticultural Services Group Inc. All rights reserved. Powered by <a href="http://www.register.com/" target="_blank">Register.com</a></span> </td> </tr> </table> </div> </body> </html> Above is the HTML form. <?php if (isset($_POST['submit'])){ $error = array(); // ************************** // add fields validations here if(empty($_POST['fname'])){ $error[] = "Please enter your first name."; } if(empty($_POST['lname'])){ $error[] = "Please enter your last name."; } if(empty($_POST['phone'])){ $error[] = "Please enter a phone number."; } // ************************** if(count($error) > 0 ){ $q = urlencode(implode(';',$error)); header('Location: contact.php?q='.$q); } else { for($i=0;$i<25;$i++){ if(!empty($_POST['check'.$i]))$aChecks[] = $_POST['check'.$i]; } $industry = implode(" | ",$aChecks); $real_time = $_POST['real_time']; $hot_transfer = $_POST['hot_transfer']; $email = $_POST['email']; $fname = $_POST['fname']; $lname = $_POST['lname']; $metod = $_POST['metod']; $company = $_POST['company']; $phone = $_POST['phone']; $address = $_POST['address']; $city = $_POST['city']; $state = $_POST['state']; $zip = $_POST['zip']; $comments = $_POST['comments']; $Ssubject = "Form message submitted from ".$_SERVER['HTTP_HOST']."\r\n"; $Sheaders = "From: $name <$email>\r\n"; $Sheaders .= "Reply-To: $email\r\n"; $Sheaders .= "X-Mailer: PHP\r\n"; $Sheaders .= "Mime-Version: 1.0\r\n"; $Sheaders .= "Content-Type: text/plain; charset=\"iso-8859-1\"\r\n"; $Sheaders .= "Content-Transfer-Encoding: 8bit\r\n"; $Smsg = "Contact Information.\r\n\r\n"; $Smsg .= "--------------------------------------------------------------------------- \r\n"; $Smsg .= "First Name: $fname\r\n"; $Smsg .= "Last Name: $lname\r\n"; $Smsg .= "Address: $address\r\n"; $Smsg .= "City: $city\r\n"; $Smsg .= "State: $state\r\n"; $Smsg .= "Zip: $zip\r\n"; $Smsg .= "Email: $email\r\n"; $Smsg .= "Phone: $phone\r\n"; $Smsg .= "Contact Method: $metod\r\n"; $Smsg .= "Questions or Comments: $comments\r\n"; $Smsg .= "--------------------------------------------------------------------------- \r\n"; $sent = mail("todd@revivemediaservices.com", $Ssubject, $Smsg, $Sheaders); // echo "SENT:$sent -- EMAIL:$email -- SUBJECT:$Ssubject -- MSG:$Smsg -- HEADERS:$Sheaders "; } } ?> <!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>Horticultural Service | Landscape Consultant | W. Florida Panhandle | Landscaping</Title> <META NAME="Author" CONTENT="Horticultural Service Group"> <META NAME="Subject" CONTENT="Horticultural Service Group offering landscape consulting and Horticultural pruning and trimming."> <META NAME="Description" CONTENT="Horticultural Service company serving the W. Florida Panhandle region. Offering landscape consulting service and horticultural correct pruning of trees and bushes. Residential landscaping, tree trimming and consulting service."> <META NAME="Keywords" CONTENT="horticultural service,horticulture, pruning,tree pruning,pruning plants,pruning bushes,tree trimming,landscaping, landscaping yards,residential landscaping,landscape architecture, backyard landscape,W. Florida Panhandle,FL panhandle"> <META NAME="Language" CONTENT="English"> <META NAME="Copyright" CONTENT="© Horticultural Service Group"> <META NAME="Revisit-After" CONTENT="15 Days"> <META NAME="Distribution" CONTENT="Global"> <META NAME="Robots" CONTENT="Follow, All"> <link href="css/style.css" rel="stylesheet" type="text/css" /> <script type="text/javascript"> <!-- function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; } function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} } function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x; } function MM_swapImage() { //v3.0 var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} } //--> </script> <!--=========================================================== Script: JavaScript Cross-Browser SlideShow Script With Cross-Fade Effect between Images Adjustable Timing and Unlimited Images Function: Displays images continuously in a slideshow presentation format, with a fade effect on image transitions. Browsers: All common browsers: NS3-6, IE 4-6 Fade effect only in IE; others degrade gracefully Author: etLux =========================================================== Step 1. Put the following script in the head of your page:--> <script> // (C) 2000 www.CodeLifter.com // http://www.codelifter.com // Free for all users, but leave in this header // NS4-6,IE4-6 // Fade effect only in IE; degrades gracefully // ======================================= // set the following variables // ======================================= // Set slideShowSpeed (milliseconds) var slideShowSpeed = 5000 // Duration of crossfade (seconds) var crossFadeDuration = 3 // Specify the image files var Pic = new Array() // don't touch this // to add more images, just continue // the pattern, adding to the array below Pic[0] = 'images/image_eight.jpg' Pic[1] = 'images/image_two.jpg' Pic[2] = 'images/image_six.jpg' Pic[3] = 'images/image_seven.jpg' Pic[4] = 'images/image_one.jpg' Pic[5] = 'images/image_nine.jpg' // ======================================= // do not edit anything below this line // ======================================= var t var j = 0 var p = Pic.length var preLoad = new Array() for (i = 0; i < p; i++){ preLoad[i] = new Image() preLoad[i].src = Pic[i] } function runSlideShow(){ if (document.all){ document.images.SlideShow.style.filter="blendTrans(duration=2)" document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)" document.images.SlideShow.filters.blendTrans.Apply() } document.images.SlideShow.src = preLoad[j].src if (document.all){ document.images.SlideShow.filters.blendTrans.Play() } j = j + 1 if (j > (p-1)) j=0 t = setTimeout('runSlideShow()', slideShowSpeed) } </script> </head> <body onload="MM_preloadImages('images/title_home_b.jpg','images/title_about_b.jpg','images/title_gallery_b.jpg','images/title_landscape_b.jpg','images/title_services_b.jpg','images/title_contact_b.jpg'), runSlideShow()"> <div align="center"> <table width="909" border="0" cellspacing="0" cellpadding="0"> <tr> <td colspan="3" align="center" valign="bottom"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td colspan="2"><img src="images/header_top.jpg" alt="Horticultural Services Inc." width="909" height="98" longdesc="index.html" /></td> </tr> <tr> <td width="602" align="left"><img src="images/header_left.jpg" alt="Horticulture Services Group Inc.Inc." width="602" height="185" longdesc="about.html" /></td> <td align="left"><img src="images/image_eight.jpg" alt="Landschaft" name="SlideShow" width="308" height="185" id="SlideShow" longdesc="index.html" /></td> </tr> </table></td> </tr> <tr> <td width="81" height="29"><span class="buttoms_left"><img src="images/buttoms_left.jpg" width="81" height="29" /></span></td> <td width="474" align="right" bgcolor="#424242"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="56"><a href="index.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Home','','images/title_home_b.jpg',1)"><img src="images/title_home.jpg" alt="Home" name="Home" width="56" height="29" border="0" id="Home" /></a></td> <td width="75"><a href="about.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('About Us','','images/title_about_b.jpg',1)"><img src="images/title_about.jpg" alt="About Us" name="About Us" width="75" height="29" border="0" id="About Us" /></a></td> <td width="63"><a href="gallery.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Gallery','','images/title_gallery_b.jpg',1)"><img src="images/title_gallery.jpg" alt="Gallery" name="Gallery" width="63" height="29" border="0" id="Gallery" /></a></td> <td width="125"><a href="wordpress/index.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Landscape News','','images/title_landscape_b.jpg',1)"><img src="images/title_landscape.jpg" alt="Landscape News" name="Landscape News" width="125" height="29" border="0" id="Landscape News" /></a></td> <td width="71"><a href="services.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Services','','images/title_services_b.jpg',1)"><img src="images/title_services.jpg" alt="Services" name="Services" width="71" height="29" border="0" id="Services" /></a></td> <td align="left"><a href="contact.php"><img src="images/title_contact_b.jpg" alt="Contact" name="Contact" width="83" height="29" border="0" id="Contact" /></a></td> </tr> </table></td> <td width="354" align="right"><span class="buttoms_right"><img src="images/buttoms_right.jpg" width="354" height="29" /></span></td> </tr> <tr> <td height="46" colspan="3" class="bottom_header"> </td> </tr> </table> <table width="909" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="63" height="426" class="flowers_left"> </td> <td align="center" valign="top" class="content_repeat"><table width="725" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="420" align="left" valign="top" class="content_center"><h1><img src="images/titles_contact_us.jpg" alt="Contact Us" width="120" height="17" longdesc="index.html" /></h1> <p>Thanks! We will contact you soon, <a href="index.html">back to Home</a>.</p> </td> <td width="215" align="center" valign="top"> <a href="sign_up.php"><img src="images/subscribe_link.jpg" border="0" /></a><br /><br /> <img src="images/image_nature.jpg" alt="Nature" width="194" height="195" longdesc="index.html" /> <p><span class="highlighted">Horticultural Services Group</span><br /> Phone: <b>850-603-9783</b><br /> Fax: <b>800-521-4213</b></p> <p><a href="organizations.html"><strong>Organizations</strong></a></p> <p><a href="http://www.facebook.com/pages/Crestview-FL/Horticulture-Services-Group-Inc/126426941305?ref=ts" target="_blank"><img src="images/facebook.jpg" border="0" /></a></p></td> </tr> </table></td> <td width="51" height="426" class="flowers_right"> </td> </tr> </table> <table width="909" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="69" align="center" valign="top" class="footer"> <a href="index.html">Home</a> | <a href="about.html">About Us</a> | <a href="gallery">Gallery</a> | <a href="wordpress/index.php">Landscape Blog</a> | <a href="contact.php">Contact Us</a> | <a href="wordpress/wp-admin/index.php" style="text-decoration:underline;"><i>Panel Access Management</i></a><br /> <span id="footer">Copyright ©Horticultural Services Group Inc. All rights reserved. Powered by <a href="http://www.register.com/" target="_blank">Register.com</a></span> </td> </tr> </table> </div> </body> </html> That's the processing script right now. When we use that we do not receive an email. So trying to figure out what was up, we made this file: <?php mail("todd@revivemediaservices.com", "test message from godaddy", "this is a test message, if you are reading this the email was sent successfully."); ?> When we use that, we receive the email although it takes about 15+ minutes. In our troubleshooting, we took a script off of my website and tested it. That's this code: <?php require_once('wp-blog-header.php');?> <?php require_once('magpierss/rss_fetch.inc');?> <?php require_once('_inc/functions.php');?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US"> <head profile="http://www.w3.org/2000/08/w3c-synd/#"> <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" /> <title><?php wp_title('«', true, 'right'); ?> <?php bloginfo('name'); ?></title> <link rel="stylesheet" href="wp-content/themes/bp/reset.css" type="text/css" media="screen" /> <link rel="stylesheet" href="wp-content/themes/bp/style.css" type="text/css" media="screen" /> <!--[if IE]> <link href="<?php bloginfo('template_url'); ?>/ie_only.css" rel="stylesheet" type="text/css"> <![endif]--> <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" /> <meta name="generator" content="Brandon Pence" /> <meta name="keywords" content="brandon pence, digital artist, florida, gulf coast, niceville, modern artist," /> <meta name="description" content="The official website of the artist Brandon Pence. Living in the Gulf Coast of Florida, Brandon Pence is a modern digital artist." /> <script type="text/javascript" src="http://ajax.googleapis <?php $site_email = $row["example@madhost.co"]; $email25=$_REQUEST['email']; $action=$_REQUEST['action']; if ($action=="") /* display the contact form */ { ?> <form id="ContactForm" action="" method="POST" enctype="multipart/form-data"> <input type="hidden" name="action" value="submit"> <div> <div class="wrapper"> <span>Your Name:</span> <input type="text" class="input" name="name" maxlenght="15"> </div> <div class="wrapper"> <span>Your E-mail:</span> <input type="text" class="input" name="email" > </div> <div class="textarea_box"> <span>Your Message:</span> <textarea name="textarea" cols="1" rows="1"></textarea> </div> <input type="submit" class="button1"> <a href="contact.php" class="button1">Clear</a> </div> </form> <?php } else /* send the submitted data */ { $name=$_REQUEST['name']; $email=$_REQUEST['email']; $message=$_REQUEST['textarea']; if (($name=="")||($email=="")||($message=="")) { echo "All fields are required, please fill <a href=\"\">the form</a> again."; } else{ $from="From: $name<$email>\r\nReturn-path: $email"; $subject= $subject1; mail($to =$site_email, $message, $from); echo " <div class=\"contactform\"> Thank you for contacting us, please wait for our reply! </div> "; } } ?>The only problem is that im not recieving the email :/ Any Help ? I would really appreciate it and thank you Hi
I am trying to use mail(), but when I try it i am not receiving the email. Code is as follows
$username=$_POST['username']; $email=$_POST['email']; $password=$_POST['password']; //email user $from='registrations@ispeedwayscores.com'; $to=$email; $subject='Thank you for registering at iSpeedwayScores'; $message ='<html> <body bgcolor="#000000" style="color:#FF9900; font:Verdana, Arial, Helvetica, sans-serif"> <center> <h1>Welcome to iSpeedwayScores</h1> <br/> <p>Hi!</p> <br> <p>Thank you for joining iSpeedwayScores, this is your <b>FREE</b> online speedway scorecard site.</p> <p>Your login details are provided below:</p> Username: '.$username.'<br/> Password: '.$password.'<br/> <p>We hope you enjoy using the site, if you do, please tell others, if not please tell us</p> <h3>iSpeedwayScores</h3> </body> </html>'; //end of message $headers = "From: $from\r\n"; $headers .= "Content-type: text/html\r\n"; //options to send to cc+bcc $headers .= "Bcc: mark@bravo14.co.uk"; // now lets send the email. if(mail($to, $subject, $message, $headers)){ $message=" Message sent successfully"; $regsuccess = "Message sent successfully"; } else{ $message=" Message not sent"; $regfailure ="Message not sent"; } I have found it a bit strange recently how i stopped receiving online emails from my website, we havnt changed the code as far as i am aware. but for some reason neither the user or staff receives an email the code below is our process for the mail. please could somebody advise why? <?php $host="localhost"; // Host name $username="HIDDEN"; // Mysql username $password="HIDDEN"; // Mysql password $db_name="HIDEEN"; // Database name $tbl_name="HIDDEN"; // Table name $name = $_POST['name']; $email = $_POST['email']; $web = $_POST['web']; $tel = $_POST['tel']; $sub = $_POST['sub']; $message = $_POST['message']; $ip = $_SERVER['REMOTE_ADDR']; $datetime=date("d-m-y"); //date time // validation function is_valid_email($email) { return preg_match('#^[a-z0-9.!\#$%&\'*+-/=?^_`{|}~]+@([0-9.]+|([^\s]+\.+[a-z]{2,6}))$#si', $email); } if (!is_valid_email($email)) { print "<meta http-equiv=\"refresh\" content=\"0;URL=../Contact/?sent=error\">"; exit; } $validationOK=true; if (Trim($name)=="") $validationOK=false; if (Trim($email)=="") $validationOK=false; if (Trim($tel)=="") $validationOK=false; if (Trim($sub)=="") $validationOK=false; if (Trim($message)=="") $validationOK=false; if (!$validationOK) { print "<meta http-equiv=\"refresh\" content=\"0;URL=../Contact/?sent=error\">"; exit; } $EmailFrom = Trim(stripslashes($_POST['email'])); $EmailTo = "info@msukgroup.co"; $Subject2 = Trim(stripslashes($_POST['sub'])); $Name = Trim(stripslashes($_POST['name'])); $Comments = Trim(stripslashes($_POST['message'])); $Subject = "MSUKGroup - Thankyou For Contacting "; // STAFF EMAIL $staffmail = ' <!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" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>MSUKGroup</title> <style> p { margin-top:0; margin-bottom:4px; } </style> </head> <body style="color: #666666; font-size:small; font-family:Franklin Gothic Book"> <table style="width: 516px; height: 42px;" cellspacing="0" cellpadding="0"> <!-- MSTableType="layout" --> <tr> <td valign="top" style="height: 42px; width: 516px"> <table style="width: 500px; height: 42px;" cellspacing="0" cellpadding="0"> <!-- MSTableType="layout" --> <tr> <td valign="top" style="height: 42px; width: 500px"> <img src="http://msukgroup.co/img/logos/orange.png" width="323" height="42" /></td> </tr> </table> </td> </tr> </table> <p>Dear ' . $name . ',</p> <p>Thankyou for contacting the MSUKGroup via our online submission form. A relevant representative will be with you within 24 hours to assist you further with your query. </p> <p>Here is what we gathered from your query:</p> <table style="width: 100%" cellspacing="4" cellpadding="0"> <tr> <td style="width: 60px" align="right"><strong> Name:</strong></td> <td> ' . $name . '</td> </tr> <tr> <td style="width: 60px" align="right"><strong> Email:</strong></td> <td> ' . $email . '</td> </tr> <tr> <td style="width: 60px" align="right"><strong> Website:</strong></td> <td> ' . $web . '</td> </tr> <tr> <td style="width: 60px" align="right"><strong> Tel:</strong></td> <td> ' . $tel . '</td> </tr> <tr> <td style="width: 60px" align="right"><strong> Subject:</strong></td> <td> ' . $sub . '</td> </tr> <tr> <td style="width: 60px" align="right"><strong> Message:</strong></td> <td> ' . $message . '</td> </tr> </table> <p>In the meantime, if you have any unanswered questions please take a look around our website and you&#39;ll find out more about our group and services.</p> <p><img src="http://msukgroup.co/img/logo3.png" width="129" height="21" /></p> <p>Hosting - Designs - eCommerce - Solutions - Events and more...</p> <p><strong>Web:<br /> </strong><a href="http://www.msukgroup.co"><span style="color:#FF7800">http://www.msukgroup.co</span></a></p> <p><strong>Email:<br /> </strong><a href="http://www.msukgroup.co"><span style="color:#FF7800"> info@msukgroup.co</span></a></p> </body> </html> '; // USER EMAIL $usermail = ' <!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" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>MSUKGroup</title> <style> p { margin-top:0; margin-bottom:4px; } </style> </head> <body style="color: #666666; font-size:small; font-family:Franklin Gothic Book"> <table style="width: 516px; height: 42px;" cellspacing="0" cellpadding="0"> <!-- MSTableType="layout" --> <tr> <td valign="top" style="height: 42px; width: 516px"> <table style="width: 500px; height: 42px;" cellspacing="0" cellpadding="0"> <!-- MSTableType="layout" --> <tr> <td valign="top" style="height: 42px; width: 500px"> <img src="http://msukgroup.co/img/logos/orange.png" width="323" height="42" /></td> </tr> </table> </td> </tr> </table> <p>Hello Admin,</p> <p>' . $name . ' has sent a message using the contact form on the site.<br> <strong>Date Message Sent: ' . $datetime . ' <br> IP Address: ' . $ip . ' </strong><br> </p> <p>Here is what we gathered from their query:</p> <table style="width: 100%" cellspacing="4" cellpadding="0"> <tr> <td style="width: 60px" align="right"><strong> Name:</strong></td> <td> ' . $name . '</td> </tr> <tr> <td style="width: 60px" align="right"><strong> Email:</strong></td> <td> ' . $email . '</td> </tr> <tr> <td style="width: 60px" align="right"><strong> Website:</strong></td> <td> ' . $web . '</td> </tr> <tr> <td style="width: 60px" align="right"><strong> Tel:</strong></td> <td> ' . $tel . '</td> </tr> <tr> <td style="width: 60px" align="right"><strong> Subject:</strong></td> <td> ' . $sub . '</td> </tr> <tr> <td style="width: 60px" align="right"><strong> Message:</strong></td> <td> ' . $message . '</td> </tr> </table> <p>He has been notified of a 24 hour wait so please respond within this time frame.</p> <p><img src="http://msukgroup.co/img/logo3.png" width="129" height="21" /></p> <p>Hosting - Designs - eCommerce - Solutions - Events and more...</p> <p><strong>Web:<br /> </strong><a title="MSUKGroup" href="http://www.msukgroup.co"><span style="color:#FF7800">http://www.msukgroup.co</span></a></p> <p><strong>Email:<br /> </strong><a href="http://www.msukgroup.co"><span style="color:#FF7800"> info@msukgroup.co</span></a></p> </body> </html> '; // 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"; // Additional headers $headers .= 'From: DO NOT REPLY - MSUKGroup <noreply@msukgroup.co>' . "\r\n"; // Mail it mail($EmailTo, $Subject2, $usermail, $headers); mail($EmailFrom, $Subject2, $staffmail, $headers); // Connect to server and select database. mysql_connect("$host", "$username", "$password")or die("cannot connect server "); mysql_select_db("$db_name")or die("cannot select DB"); $sql="INSERT INTO $tbl_name(name, email, web, tel, sub, message, date, ip)VALUES('$name', '$email', '$web', '$tel', '$sub', '$message', '$datetime', '$ip')"; $result=mysql_query($sql); //check if query successful if($result){ print "<meta http-equiv=\"refresh\" content=\"0;URL=../Contact/?sent=successful\">"; } else { print "<meta http-equiv=\"refresh\" content=\"0;URL=../Contact/?sent=error\">"; } mysql_close(); ?> Hello all! I am trying to send mail using the "Mail.php" function but I cant figure out whats going wrong. The insert function works in the database but not the sending mail function. Please let point me in the right direction, thanks for your help in advance!
<?php if(isset($_POST)){ //If the post is not empty, continue if(!empty($_POST)) { include_once 'includes.php'; require_once 'Mail.php'; $from = "Name <email@foobar.com>"; $subject = $_POST['subject']; $text = $_POST['newsletterBody']; $host = "host"; $port = "port"; $username = "EMAILUSERNAME"; $password = "EMAILPASSWORD"; echo "Subject: " . $subject; echo "<br />Body: " . $text; echo "<br />Host: " . $host; echo "<br />Port: " . $port . "<br />"; $sql = 'INSERT INTO newsletter_log (date,title,body) VALUES (:time,:subject,:body)'; $params = array( ':subject' => $subject, ':body' => $text, ':time' => time()); $poststmt = $DBH->prepare($sql); $poststmt->execute($params); if($poststmt) { echo "Saved to the database."; } else { echo "Not saved."; } $sqlSubUsers = 'SELECT * FROM test_newsletter WHERE newsletter_id = 1'; $newsletterStmt = $DBH->prepare($sqlSubUsers); $newsletterStmt->execute(); $userIds = $newsletterStmt->fetch(PDO::FETCH_ASSOC); echo $userIds; foreach ($userIds as $row){ $getUserEmailSql = 'SELECT email_addr FROM newsletter_emails WHERE id =' . $row['people_id']; $getUserEmailStmt = $DBH->prepare($getUserEmailSql); $getUserEmailStmt->execute(); $userEmail = "<" . $getUserEmailStmt->fetch(PDO::FETCH_COLUMN,0) . ">"; $userEmail->closeCursor(); $html = "<html><body>" . $text . "</html></body>"; $headers = array ('From' => $from, 'To' => $userEmail, 'Subject' => $subject); $smtp = Mail::factory('smtp', array ('host' => $host, 'port' => $port, 'username' => $username, 'password' => $password)); $mail = $smtp->send($to, $headers, $html); echo $userEmail; if (PEAR::isError($mail)) { echo("<p>" . $mail->getMessage() . "</p>"); } else { echo("<p>Message successfully sent!</p>"); } } echo 'Newsletter Sent.'; } else { echo '<h3>No newsletter was sent.</h3>'; } } ?>I have removed the emails, host, port, username and password along with in other information I did not think I should send over. Hi, I'm getting the below error while sending mail. Error: Code: [Select] Warning: mail() [function.mail]: SMTP server response: 550 5.7.1 Unable to relay for cys@kdkd.com in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\mail.php on line 39 Code: Code: [Select] if (isset($_POST["submit"])) { $to = strip_tags($_POST["to"]); $sub = strip_tags($_POST["sub"]); $feedback = strip_tags($_POST["feedback"]); $from = strip_tags($_POST["from"]); $to= "xyz@gmail.com"; $sendto = $to; $subject = $sub; $message = $feedback; $headers ="MIME-Version:1.0\r\n"; $headers .="content-type:text/html; Charset=iso-8859-1\r\n"; $headers .="From: <" . "$from" . ">\r\n"; $headers .="X-Sender: <" . "$sendto" . ">\r\n"; $headers .="Return-Path: <" . "$sendto" . ">\r\n"; $headers .="Error-To: <" . "$sendto" . ">\r\n"; $sendto = trim($sendto); $themail= mail($sendto, $subject, $message, $headers) ; } Kindly help. Thanks, Ramki Hi Sending mail problem, it going as plain text<?php include("global.php"); $Form_ID = $_GET['Form_ID']; $Page_ID = $_GET['Page_ID']; $Menu_ID = $_GET['Menu_ID']; $website_email = $g_setups[website_email]; $website_name = $Language_Website_Name; $website_link = $g_setups[website_link]; //get the Email Address from the Form Table #Email Address has taken from the Form Table,(may contain more than 1 email IDS) $email = "SELECT * FROM form where Form_ID = ".$Form_ID; $temps_email = $DB_site->query($email); $temp_email = $DB_site->fetch_array($temps_email); $add = explode("\n",$temp_email[Form_Email]); $address_count = count($add); $f=""; $frm = "SELECT * FROM field where Form_ID = ".$Form_ID; $temps = $DB_site->query($frm); while($temp = $DB_site->fetch_array()) { $value=""; //var_dump($_POST); //exit(); $nos = count($_POST["a".$temp[Field_ID]]); if($nos == 1) { $value = $_POST["a".$temp[Field_ID]]; } else { for($i=0;$i<$nos;$i++) { $value = $value.$_POST["a".$temp[Field_ID]][$i]; } } //echo $value; //exit(); $f = $f."<div style=' background-color:gray; clear:left;'><div style='float:left; width:150px; text-align:left; background-color:#f7f4f3;'>".$temp[Field_Name]."</div>". "<div style='float:left; width:350px; text-align:left; background-color:#f7f4f3;'>".$value."</div></div>"; } // Your email subject text $esubject = "Forms"; // Email Content //Get the Form Field Ids and Form Values and Mail It $emailtext = " <div style='width:500px; height=800px'> <div style='background-color:gray;'>Form</div> <div style=''><p>$f</p></div> </div> "; $headers = 'From: '.$website_name .'noreply@'.$website_link.'' . "\r\n" . 'Reply-To: noreply@'.$website_link.'' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); # This sends the email to you for($i=0;$i<$address_count;$i++) { //@mail("$add[$i]", $esubject, $emailtext, $header); mail("$add[$i]", $esubject, $emailtext, $header); //echo "send sucess"; } echo "<meta http-equiv=Refresh content=1;url='none.php?do=pagelink&Page_ID=$Page_ID&Menu_ID=$Menu_ID&mail_msg=sucess'>"; exit; ?> Thanks Can anyone tell me why this code is not working: Code: [Select] <?php $d = $_GET['p']; $u = $_GET['u']; $email_to = $_GET['e']; $email_from = "no-reply@mydomain.com"; $headers = "From: " . $email_from; $fileatt = "$d/pdffile.pdf"; $fileatt_type = "application/pdf"; $fileatt_name = "$d/pdffile.pdf"; $email_subject = "Your pdffile"; $email_message = "blablabla"; $email_message .= "Thanks for visiting.<br>"; $file = fopen($fileatt,'rb'); $data = fread($file,filesize($fileatt)); fclose($file); $semi_rand = md5(time()); $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x"; $headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\""; $email_message .= "This is a multi-part message in MIME format.\n\n" . "--{$mime_boundary}\n" . "Content-Type:text/html; charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $email_message .= "\n\n"; $data = chunk_split(base64_encode($data)); $email_message .= "--{$mime_boundary}\n" . "Content-Type: {$fileatt_type};\n" . " name=\"{$fileatt_name}\"\n" . //"Content-Disposition: attachment;\n" . //" filename=\"{$fileatt_name}\"\n" . "Content-Transfer-Encoding: base64\n\n" . $data .= "\n\n" . "--{$mime_boundary}--\n"; $ok = @mail($email_to, $email_subject, $email_message, $headers); if($ok) { echo "Dear $u,<br /><br />blablabla."; } else { die("Sorry but the email could not be sent. Please go back and try again!"); } ?> This code is working properly: Code: [Select] <?php $fileatt = "dirname/myfile.pdf"; $fileatt_type = "application/pdf"; $fileatt_name = "dirname/myfile.pdf"; $email_from = "no-reply@mydomain.com"; $email_subject = "subject"; $email_message = 'Hi,<br /><br />blablabla<br>'; $email_message .= "<br /><br />Thanks for visiting.<br>"; $email_to = 'info@mydomain.com'; //$e; $headers = "From: ".$email_from; $file = fopen($fileatt,'rb'); $data = fread($file,filesize($fileatt)); fclose($file); $semi_rand = md5(time()); $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x"; $headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\""; $email_message .= "This is a multi-part message in MIME format.\n\n" . "--{$mime_boundary}\n" . "Content-Type:text/html; charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $email_message .= "\n\n"; $data = chunk_split(base64_encode($data)); $email_message .= "--{$mime_boundary}\n" . "Content-Type: {$fileatt_type};\n" . " name=\"{$fileatt_name}\"\n" . //"Content-Disposition: attachment;\n" . //" filename=\"{$fileatt_name}\"\n" . "Content-Transfer-Encoding: base64\n\n" . $data .= "\n\n" . "--{$mime_boundary}--\n"; $ok = @mail($email_to, $email_subject, $email_message, $headers); if($ok) { echo 'Hi '..'File has been sent to your e-mail address: '; echo '<br />Go check your mailbox and check your spam box.<br /><br />Thanks for your order!<br /><br />blablabla'; } else { die("Sorry but the email could not be sent. Please go back and try again!"); } ?> Maybe it is possible to add it as require_once with a function? I am lost now, strange I cannot get it at work properly with $_post / $_get... Hi Guys, I've got a contact form set up, where the user can submit their design they have created on the site. The file uploads to a directory titled "Uploads" and the idea would then be set up a link within an HTML style E-Mail, I've had a look at MIME-TYPE on the php.net manual. I've got the form to work to an extent, however the PHP variables are not being echo'ed out and the E-Mail looks like this : Quote <html> <body> <b>New Design by $name </b> <p>Contact Details...</p> Telephone : $telephone<br /> E-Mail : $email<br /> Design : <a href=http://wwww.mysite.co.uk/Mail%20Test/uploads/$upfile>$upfile</a> </body> </html> New EasyFluid Design Added My Code is as follows : Code: [Select] <?php $to = ""; // User E-Mail $subject = "New Design Added"; // The Subject //$target_path = "uploads/"; // $target_path = $target_path . basename( $_FILES['design']['name']); //if(move_uploaded_file($_FILES['design']['tmp_name'], $target_path)) { //} extract($_POST); $from = "From: {$_POST['name']} <{$_POST['email']}>"; // From (the field named "name" and the email field named "email" //Handle the Image $upfile = 'uploads/' .$_FILES['design']['name'] ; if (is_uploaded_file($_FILES['design']['tmp_name'])) { if (!move_uploaded_file($_FILES['design']['tmp_name'], $upfile)) { echo 'Problem : Could not move file to destination directory'; exit; } } $message = ' <html> <body> <b>New Design by $name </b> <p>Contact Details...</p> Telephone : $telephone<br /> E-Mail : $email<br /> Design : <a href=http://wwww.mysite.co.uk/Mail%20Test/uploads/$upfile>$upfile</a> </body> </html> '; // 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"; mail($to, $from, $subject, $message, $headers); // HTML Style E-Mail ?> Any help on how I can correct this would be much appreciated. Thanks |