PHP - Mail Sending Error! Please Help.
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 Similar TutorialsI 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); 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; 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'); ? 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> 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"; } 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 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(); ?> <?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'm receiving two emails with this code.. one from "webmaster" and another from "serveradmin." What's odd is that the one from serveradmin contains the subject, but not the message. Does anyone know why this is happening and how to fix it so I only receive one email? thanks -- here's the code $usercheck = $_SESSION['user_id']; $check = mysql_query("SELECT * FROM articles WHERE art.id = '$_GET[id]' AND art.user_id = '$usercheck'")or die(mysql_error()); $check2 = mysql_num_rows($check); $recep = "me@gmail.com"; $subject = "Email Subject Line"; $text = "$usercheck"; $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/plain; charset=UTF-8\r\n"; $headers .= "Reply-to: me@gmail.com\n"; $headers .= "X-Mailer: PHP\n"; if ($check2 != 1) { include_once ("nav_my_account.inc"); mail("$recep","$subject","$text","$headers"); $content = "<p>You can only edit your own articles. <br><br>If you feel you're getting this message in error, it may be that your session has timed out and you need to log back in. </p>\n"; } else { include_once ("nav_my_account.inc"); .....etc.... 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 Hi all Im sending a dynamic created pdf file with php. It gets flagged as spam are things that can be done to help prevent this ? didnt really know where to post it. 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 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... Here is the code I have so far: <?php include('database.inc.php'); // Our database connectivity file ?> <?php $reminder_date = 't1.reminder_date'; $email = 'lp_reminder_email'; $reminder_name = 't1.reminder_name'; $reminder_details = 't1.reminder_desc'; $result = mysql_query($sql) or die(mysql_error()); $sql = "SELECT t1.`reminder_id` , t1.`reminder_name` , t1.`reminder_desc` , t1.`reminder_date` , t1.`reminder_email` , lp4.`email` AS `lp_reminder_email` FROM `reminder_events` AS t1 LEFT OUTER JOIN `authorize` AS lp4 ON ( t1.`reminder_email` = lp4.`email` ) WHERE reminder_date <= NOW() ORDER BY `reminder_date` ASC"; $result = 'mysql_num_rows'; while( $row = mysql_fetch_array( $result ) ) if( !empty( $nr ) ) ?> <?php $to = $row[$email]; $from = $row[$email]; $headers = $from; $subject = $row[$reminder_name]; $body = $row[$reminder_details]; { $send = @mail($to, $subject, $body, $headers); } ?> The sql query when run through phpMyAdmin returns a result. When I open this in the browser, it says "Query is empty". Anyone want to help a newb out and show me what I'm doing wrong? I'd like for it to pull the data out of these fields and send it via e-mail. What would be even better is if I could get it to do this the day before the `reminder_date`. I can set it up so cron runs the script, I just need to get the script to work first. Thanks in advance for your help. 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 All, I am attaching the code of my php script, the script needs to send mail , but is unable to do so.Your help will be greatly appreciated. Thanks Tanu I found the below code so I can attach a file to a email message, but there is a small problem I need some help with. The script works beautifully except for the fact that when message is received the attached file does not contain a file extension. I am able to open the attachment but I am receiving the windows dialog box that asks: "Choose the program you want to open this file". I intend on only using this script to attach HTML files so I am wondering if there is a way to make the file extension of the attachment read as .html? That way when the user receives the attachment it will automatically open with there default browser. Code: [Select] <?php $to = "test@test.com"; $from = "test@test.com"; $subject = "AHC"; $message = "hello world"; $fileatt = $_SERVER['DOCUMENT_ROOT']."/home-care-information/test.html"; $fileatt_type = "multipart/alternative"; //This is where the problem is I think $fileatt_name = "Application"; $headers = "From: $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}\""; $message = "This is a multi-part message in MIME format.\n\n" . "--{$mime_boundary}\n" . "Content-Type: text/plain; charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $message . "\n\n"; $data = chunk_split(base64_encode($data)); $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($to, $subject, $message, $headers); if ($ok) { echo "<p>Mail sent! Yay PHP!</p>"; } else { echo "<p>Mail could not be sent. Sorry!</p>"; } ?> Hi I really would appreciate if some phpfreak can help me with this please . I need to my contact page send emails so that when recipient receives it, it comes with the correct domain (same as the web address) it is coming from rather than the server name. At the moment they are coming as abcd20@elessar.nocdirect.com and would like them come as abcd20@myowndomain.com (lets say my password for that email is 'zzzaaa' and the domain was myowndomain.com ) Here is my email contact php script which works fine and hopefully would not have to change too much. My Contact form is posting to 'send.php' . On top of my contacts page there is a js script for 'jquery.js' and some jQuery stuff for validation.. Have seen many scripts but could not adapt to my existing send.php script. Can you please help? ------ Content of 'send.php' ----------------------------------- <?php if(!$_POST) exit; $email = $_POST['email']; //$error[] = preg_match('/\b[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b/i', $_POST['email']) ? '' : 'INVALID EMAIL ADDRESS'; if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$email )){ $error.="Invalid email address entered"; $errors=1; } if($errors==1) echo $error; else{ $values = array ('name','email','phone','message'); $required = array('name','email','phone','message'); $your_email = "abcd20@myowndomain.com"; $email_subject = "New Message: ".$_POST['subject']; $email_content = "New message:\n"; foreach($values as $key => $value){ if(in_array($value,$required)){ if ($key != 'subject' && $key != 'company') { if( empty($_POST[$value]) ) { echo 'PLEASE FILL IN REQUIRED FIELDS'; exit; } } $email_content .= $value.': '.$_POST[$value]."\n"; } } if(@mail($your_email,$email_subject,$email_content)) { echo 'Message sent!'; } else { echo 'ERROR!'; } } ?> -------------------------------------------------------------------------------- Hi Friends, I did one contact.php and process.php(also i attached txt file). This process.php file send the data to my yahoo mail id. But i didnt receive any mails from this page. I dont know what i did the mistaken. so pls kindly send me you suggestion or feedback. waiting for your valuable suggestion. contact.php <!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>testing - Contact Page</title> </head> <body> <form name="contact" method="POST" action="process.php"> <table width="456" border="0" cellpadding="0" cellspacing="0"> <tr> <td height="28" valign="top">Your name:</td> <td><input name="name" type="text"></td> </tr> <tr> <td height="28" valign="top">E-mail address:</td> <td><input name="email" type="text"></td> </tr> <tr> <td height="28" valign="top">Contact No:</td> <td><input name="contact" type="text"></td> </tr> <tr> <td height="28" valign="top">Message:</td> <td><input name="message" type="text" /></td> </tr> <tr> <td> </td> <td valign="top" align="center"><input type="submit" value="Submit" name="submit"></td> </tr> </table> </form> </body> </html> process.php <?php if(isset($_POST['submit'])) { $to = 'vjn_23@yahoo.co.in'; //put your email address on which you want to receive the information $subject = 'hello'; //set the subject of email. $headers = 'MIME-Version: 1.0' . "\r\n". 'Content-type: text/html; charset=utf-8' . "\r\n". 'From: vijay@telltales.in' . "\r\n" . 'Reply-To: vijay@telltales.in' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); $message = "<table><tr><td>Your Name</td><td>".$_POST['name']."</td></tr> <tr><td>E-Mail</td><td>".$_POST['email']."</td></tr> <tr><td>Contact No</td><td>".$_POST['contact']."</td></tr> <tr><td>Message</td><td>".$_POST['message']."</td> </tr></table>" ; mail($to, $subject, $message, $headers); header('Location: contact.php'); } ?> Thank U, vjn_23 |