PHP - Moved: Is It Must To Have A Mail Server Installed/configured To Send Mail With Php Mail
This topic has been moved to Other Web Server Software.
http://www.phpfreaks.com/forums/index.php?topic=347009.0 Similar Tutorials$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 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); Hello i m newbie to PHP. I am trying to host the website on my laptop but due to some configuration i cant send the emails through php script. I am trying send mail through mail() but not able to sent mail. heres the code: $to = "jwalant.baria@gmail.com"; $subject = "Hi!"; $body = "Hi,\n\nHow are you?"; if (mail($to, $subject, $body)) { echo("<p>Message successfully sent!</p>"); } else { echo("<p>Message delivery failed...</p>"); } Output: Message delivery failed.. I read the previous post here. but I am not able to figure out what to do about it. Can anyone tell me what setting i do in my php.ini? or any other that necessary settings require for this. i don't have SMTP server on my laptop so is there any method from which i can setup the SMTP server on laptop.? I use apache HTTP 2.2 and PHP 5.3.4 Rest of the website working correctly but only mail not working. TY..!! hi, I am trying to send an email with an attachment using PEAR, I have installed PEAR and in my email script I am including teh mail.php and mail_mime.php pages but now I get an error: Fatal error: Class 'Mail' not found in /home/fhlinux129/e/edisongray.com/user/htdocs/PEAR/Mail/mail.php on line 51 Line 51: Code: [Select] class Mail_mail extends Mail { This topic has been moved to Other Libraries and Frameworks. http://www.phpfreaks.com/forums/index.php?topic=346693.0 This topic has been moved to Other Libraries and Frameworks. http://www.phpfreaks.com/forums/index.php?topic=314260.0 This topic has been moved to Application Design. http://www.phpfreaks.com/forums/index.php?topic=347725.0 this worked and stopped, no error no idea why is this a conflict? Code: [Select] echo("<meta http-equiv = refresh content=0;url=".$url_success.">"); mail($to_supplier, $subject_supplier, $message_supplier, $headers_supplier); $ok = @mail($email_to, $email_subject, $email_message, $headers); 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 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????? I'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'); ? 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. 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, 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... 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, I have been using the mail() command for a while now, but for some reason It has just stopped functioning all together. I have added an OR DIE rule to the end of it and had no response. To all intents and purposes that mail is being sent - there are no errors whatsoever - just the mail is not getting delivered. I cannot think of anything I've done or changed that would stop it from being delivered, I haven't even been near the function that does it in a while. Here is the code: Code: [Select] function sendMail($to,$ref) { $subject = 'Booking Confirmation'; $file = "receipts/$ref.htm"; $fh=fopen($file, "r"); $message = fread($fh, filesize($file)); fclose($fh); $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: Company <noreply@company.co.uk>' . "\r\n"; mail($to, $subject, $message, $headers); } I have taken out the public names involved, but otherwise thats the code. It has worked absolutely fine in the past, and even If I strip out all of the filehandling part of it, and just use a simple $from - $to - $message, it still seems not actually send the mail. It wouldnt be so bad If I at least had an error to go on, but I dont I am just simply not getting the mail. Please help! ~Chud37 Hello, I have those code: $message = " Hello $inforow2['company']<br /> This is a notice about a pending invoice at $inforow3['company'].<br /> If you would like to see the invoice, you can see it <a href='http://$inforow3['url]'/view-invoice?id=$id.php'>here</a><br /> This is an automatic message. Replies will not be monitored.<br /> Yours faithfully<br />$inforow3['company']"; mail($inforow2['email'],"Invoice overdue #1",$message,$inforow3['sentfrom']); I'm not sure if I can send this, and it will get the values from my mysql and put it in the email or it would send the text directly, and if it ill take the html.. Can any one tell me if above code would be correct? Hi People,
I'm using a php to send an mail using a server via ssl. My program:
<?php Can somebody tell me how to make this exact code send mail? I tested it on my website and it doesn't send any emails. The first code is the file contact_config.php <?php $mailto = "youremail@email.com"; $charset = "windows-1251"; $subject = "Site visitor: ".$_POST['posName']; $content = "text/html"; $message = "Site visitor information: <br><br> Name: ".$_POST['posName'] ."<br>E-mail: ".$_POST['posEmail'] ."<br>Country: ".$_POST['posCountry'] ."<br>Phone: ".$_POST['posRegard'] ."<br>Comments: ".$_POST['posText']; $statusError = ""; $statusSuccess = ""; $errors_name = 'Please enter the Name'; $errors_mailfrom = 'Please enter the Email'; $errors_incorrect = 'The e-mail address you entered does not eppear to be valid. <br>Your e-mail address should look like yourname@domain.com'; $errors_message = 'Please enter the Message'; $errors_subject = 'Please enter the Phone'; $captcha_error = 'Wrong security code!'; $send = 'Thank you for your message'; ?> <?php $mailto = "youremail@email.com"; $charset = "windows-1251"; $subject = "Site visitor: ".$_POST['posName']; $content = "text/html"; $message = "Site visitor information: <br><br> First Name: ".$_POST['posName'] ."<br>Last Name: ".$_POST['posName2'] ."<br>E-mail: ".$_POST['posEmail'] ."<br>Telephone: ".$_POST['posRegard'] ."<br>City where jobsite is located: ".$_POST['posText'] ."<br>want us to e-mail you the free Homeowners Guide To Remodeling: ".$_POST['posBox']; $statusError = ""; $statusSuccess = ""; $errors_name = 'Please enter the First Name'; $errors_name2 = 'Please enter the Last Name'; $errors_telephone = 'Please enter the Telephone'; $errors_city = 'Please enter the City where jobsite is located'; $errors_mailfrom = 'Please enter the Email'; $errors_incorrect = 'The e-mail address you entered does not eppear to be valid. <br>Your e-mail address should look like yourname@domain.com'; $captcha_error = 'Wrong security code!'; $send = 'Thank you for your message'; ?> The second code is contacts.php <?php include('kcaptcha/kcaptcha.php'); session_start(); require_once("contact_config.php"); if ($_POST['act']== "y") { if(isset($_SESSION['captcha_keystring']) && $_SESSION['captcha_keystring'] == $_POST['keystring']) { if (isset($_POST['posName']) && $_POST['posName'] == "") { $statusError = "$errors_name"; } elseif (isset($_POST['posEmail']) && $_POST['posEmail'] == "") { $statusError = "$errors_mailfrom"; } elseif(isset($_POST['posEmail']) && !preg_match("/^([a-z,._,0-9])+@([a-z,._,0-9])+(.([a-z])+)+$/", $_POST['posEmail'])) { $statusError = "$errors_incorrect"; unset($_POST['posEmail']); } elseif (isset($_POST['posText']) && $_POST['posText'] == "") { $statusError = "$errors_message"; } elseif (!empty($_POST)) { $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: $content charset=$charset\r\n"; $headers .= "Date: ".date("Y-m-d (H:i:s)",time())."\r\n"; $headers .= "From: \"".$_POST['posName']; $headers .= "X-Mailer: My Send E-mail\r\n"; mail("$mailto","$subject","$message","$headers"); $_POST['posRegard'] = ""; $_POST['posText'] = ""; $_POST['posCountry'] = ""; $_POST['posEmail'] = ""; $_POST['posName'] = ""; unset($name, $posText, $mailto, $subject, $posRegard, $message); $statusSuccess = "$send"; } }else{ $statusError = "$captcha_error"; unset($_SESSION['captcha_keystring']); } } $cat_name="Contact $store_name manager"; ?> Now for some reason the two of these files are supposed to send me emails when customers click the submit email button on my form but, I don't get any emails. I tested it myself and no emails. Help please! |