PHP - Php Mail Form With Fasthosts Server
Similar TutorialsThis topic has been moved to Other Web Server Software. http://www.phpfreaks.com/forums/index.php?topic=347009.0 $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 Hello, im using a contact form which sends me an email with the data name.. comments .. Now im testing a new better server which use IMAP (old POP3) and my form is not working like it used to be.. Code: [Select] $emailTo = " $dbSentEmail"; //Put your own email address here $emailServer = "noreply@totalsports.com.cy"; //Put your own email address here $body = "Name: $name \n\nEmail: $email \n\nSubject: $subject \n\nComments:\n $comments"; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/plain; charset=UTF-8' . "\r\n"; $headers .= 'From: Contact Form <'.$emailServer.'>' . "\r\n" . 'Reply-To: ' . $email; mail($emailTo, $subject, $body, $headers); Any idea what i have to do to work like before? 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 having a problem with my Website mail. Basically the mail was working fine yesterday but last night I edited the PHP script slightly because for some reason the page that it was directed to had gone missing and was turning up an 404 error, which was just a newsuince as the email was still sent. So I just edited it so that it echo'ed a message saying thanks. but is seems today the mail is not getting to its destination. The PHP returns no errors and returns the success message fine but after saying its been sent it never appears. I have tried different email addresses on different servers and that was no use and I have also changed the code back to how it was yesterday. and it still doesn't work. I have also put the page up on one of my other sites which I know everything is set up properly and it works fine, making me think that it is a mail setup issue. but as I did not set up the mail at all and quite frankly don't really understand it, I don't know how it is meant to be set up as I just use google apps for sites that I set up. So yeah I am trying to work out what could have gone wrong since yesterday but I don't really understand it, below is the code as it as now and as it was yesterday: Code: [Select] <?php $EmailFrom = "johnshale@hotmail.co.uk"; $EmailTo = "matthale.live@gmail.com"; $Subject = "Website enquiry"; $Name = Trim(stripslashes($_POST['Name'])); $Tel = Trim(stripslashes($_POST['Tel'])); $Email = Trim(stripslashes($_POST['Email'])); $Message = Trim(stripslashes($_POST['Message'])); // validation $validationOK=true; if (!$validationOK) { print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">"; exit; } // prepare email body text $Body = ""; $Body .= "Name: "; $Body .= $Name; $Body .= "\n"; $Body .= "Tel: "; $Body .= $Tel; $Body .= "\n"; $Body .= "Email: "; $Body .= $Email; $Body .= "\n"; $Body .= "Message: "; $Body .= $Message; $Body .= "\n"; // send email $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>"); // redirect to success page if ($success){ print "<meta http-equiv=\"refresh\" content=\"0;URL=contactthanks.php\">"; } else{ print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">"; } ?> and the page is at www.sullyco.co.uk/contactengine.php as you can see the page is redirecting to a page that does not exist(contactthanks.php) indicating that the message was sent successfully. it is also the part I edited as a quick fix last night I just got it to echo a success message. Thanks for any help on this, I have been trying to work it out all morning, Matt Say I have an email info@website.com created in cPanel on a web hosting company. I want to send email notifications to users on my website. I am using PHP Mailer to send the emails. But all the emails go directly into their junk box/spam folder, unless they confirm that info@website.com is not junk. I am wondering if there is a work around for this? Hi, I have Code: [Select] $to = 'rberbe2002@msn.com'; $subject = 'the subject'; $message = 'hello'; $headers = 'From: webmaster@example.com'; mail($to, $subject, $message, $headers); which works fine on a shared hosting website I have, but not on a website I have on my dedicated server. Any ideas or suggestions please? Hi, I want to read multipart messages. If i send a mail from Gmail or yahoo, the body of the message is not read properly. I also want to read all the messages properly. Can someone give me the code for it? I am developing an email application for the first time. Thanks Raja Hi. I am sending out email with a php script - about 5000 at a time by send 15 or so every 20 seconds which works fine. Sometimes I need to add an attachemnt. I then find that the script will keep stalling. Is there a way to test the server qmail/mail queue to see if it isready to send another message? - rather than send it and have the script stall? It may be enough to simply be able to check that the number of messages left to be sent in the queue? Have search a lot for help on this with no results. Any server/qmail experts out there? Thanks Paul 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> 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); I have a pretty good php mailer script, but how do I get the senders email? When I test the form, the users email doesn't appear in the "From" field. Anyone know what I need to add to my code? Thanks. <?php if (array_key_exists('send', $_POST)) { // mail processing script // remove escape characters from POST array if (get_magic_quotes_gpc()) { function stripslashes_deep($value) { $value = is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value); return $value; } $_POST = array_map('stripslashes_deep', $_POST); } $from = 'Emailer Form'; $to = 'myEmail.com'; $subject = 'Interested in Urban Style Ballroom Dancing'; // list expected fields $expected = array('name', 'phone', 'email', 'address', 'city', 'state', 'zip', 'emailerMessage'); // set required fields $required = array('name', 'phone', 'email', 'address', 'city', 'state', 'zip', 'emailerMessage'); // create empty array for any missing fields $missing = array(); // process the $_POST variables foreach ($_POST as $key => $value) { // assign to temporary variable and strip whitespace if not an array $temp = is_array($value) ? $value : trim($value); // if empty and required, add to $missing array if (empty($temp) && in_array($key, $required)) { array_push($missing, $key); } // otherwise, assign to a variable of the same name as $key elseif (in_array($key, $expected)) { ${$key} = $temp; } } // go ahead only if all required fields OK if (empty($missing)) { // build the message $message = "name: $name\n\n"; $message .= "phone: $phone\n\n"; $message .= "email: $email\n\n"; $message .= "address: $address\n\n"; $message .= "city: $city\n\n"; $message .= "state: $state\n\n"; $message .= "zip: $zip\n\n"; $message .= "emailerMessage: $emailerMessage\n\n"; // limit line length to 70 characters $message = wordwrap($message, 70); // send it $mailSent = mail($to, $subject, $message); if ($mailSent) { // $missing is no longer needed if the email is sent, so unset it unset($missing); } } } ?> Okay, really dumb question... If I want to make an HTML Form that is really an E-mail Form so that visitors on my website can e-mail me, how do I do that? (I had read in a book last year that if you use an HTML Form, you can reduce/eliminate spam?!) Debbie Hey everyone. I am extremely new to PHP coding and I wanted to take a shot at making a basic mail form submission. I have done a lot of research and cannot get my test files to work. No e-mails get sent to me. I appreciate any help you can offer. Here are the following pages: http://www.insightguild.com/contactformpage.html http://www.insightguild.com/sendmail.php (coding is viewable when you navigate to this file) I am using Bluehost.com as my hosting server. Thanks I have this in a file called mailform.php. It check for valid email and phone number. If wrong it echo error but it still send the mail to me. I need for it if error not to send then redirect to same page with problems. no error redirect to main page. I can get to redirect with no problem. I can't figure out how to make it not send if errors. I hope I am explaining this right. Code: [Select] $fname = $_POST['firstName']; $lname = $_POST['lastName']; $degree = $_POST['Degree_Certificate']; $company = $_POST['companyName']; $address = $_POST['street']; $city = $_POST['city']; $state = $_POST['stateProvReg']; $phone = $_POST['phone']; $email = $_POST['email']; $message = $_POST['description']; $receive = "we receive your Affiliate information"; $formcontent=" Thank you $receive \n First Name: $fname \n Last Name: $lname \n Degree: $degree \n Company: $company \n Address: $address \n City: $city \n State: $state \n Phone: $phone \n Email: $email \n Description: $message"; $recipient = "webtechnician@brainmaster.com, $email"; $subject = "Affiliate List"; $mailheader = "From: $email \r\n"; if (validatePhone($phone)) { echo $phone . ' is a valid phone number.'; } else { echo $phone . ' is not valid phone number.'; } if (check_email_address($email)) { echo $email . ' is a valid email address.'; } else { echo $email . ' is not a valid email address, please hit the back button.'; } function check_email_address($email) { // First, we check that there's one @ symbol, and that the lengths are right if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $email)) { // Email invalid because wrong number of characters in one section, or wrong number of @ symbols. return false; } // Split it into sections to make life easier $email_array = explode("@", $email); $local_array = explode(".", $email_array[0]); for ($i = 0; $i < sizeof($local_array); $i++) { if (!ereg("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$", $local_array[$i])) { return false; } } if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) { // Check if domain is IP. If not, it should be valid domain name $domain_array = explode(".", $email_array[1]); if (sizeof($domain_array) < 2) { return false; // Not enough parts to domain } for ($i = 0; $i < sizeof($domain_array); $i++) { if (!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]+))$", $domain_array[$i])) { return false; die("hit the back button"); } } } return true; } function validatePhone($phone) { $numbersOnly = ereg_replace("[^0-9]", "", $string); $numberOfDigits = strlen($numbersOnly); if ($numberOfDigits == 7 or $numberOfDigits == 10) { echo $numbersOnly; } else { echo 'Invalid Phone Number'; } } function valIP($string) { if (preg_match( '^(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:[.](?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}$^', $string)) { echo $string; } else { echo 'Invalid IP Address'; } } mail($recipient, $subject, $formcontent, $mailheader) or die("Error!"); echo "Thank You!"; header('Location: http://#'); Hi, I have a (rather long) form on my site that when submitted send the information to me in an email. Ideally I would like to have the form only send me the information that has been filled out at current it sends everything. but for now I just need to know how I can style the email so its not one long list. also the form only comes through if an email adress is filled in it says it sends but I never recieve it. heres an example of the code for sending the email $Date = Trim(stripslashes($_POST['Date'])); $Packing = Trim(stripslashes($_POST['Packing'])); $Dismantle = Trim(stripslashes($_POST['Dismantle'])); $DismantleYes = Trim(stripslashes($_POST['DismantleYes'])); $Plumbing = Trim(stripslashes($_POST['Plumbing'])); $PlumbingYes = Trim(stripslashes($_POST['PlumbingYes'])); $LRSofa = Trim(stripslashes($_POST['LRSofa'])); $LRArmChair = Trim(stripslashes($_POST['LRArmChair'])); $LROtherChair = Trim(stripslashes($_POST['LROtherChair'])); $LRSCabinet = Trim(stripslashes($_POST['LRSCabinet'])); $LRLCabinet = Trim(stripslashes($_POST['LRLCabinet'])); $LRBookcase = Trim(stripslashes($_POST['LRBookcase'])); $LROTable = Trim(stripslashes($_POST['LROTable'])); $LRCTable = Trim(stripslashes($_POST['LRCTable'])); $LRTVStand = Trim(stripslashes($_POST['LRTVStand'])); $Body .= "Date of move: "; $Body .= $Date; $Body .= "\n"; $Body .= "Packing: "; $Body .= $Packing; $Body .= "\n"; $Body .= "Dismantle: "; $Body .= $Dismantle; $Body .= "\n"; $Body .= $DismantleYes; $Body .= "\n"; $Body .= "Plumbing: "; $Body .= $Plumbing; $Body .= "\n"; $Body .= $PlumbingYes; $Body .= "\n"; $Body .= "\n"; $Body .= "Living Room: "; $Body .= "\n"; $Body .= "Sofas: "; $Body .= $LRSofa; $Body .= "\n"; $Body .= "Arm Chairs: "; $Body .= $LRArmChair; $Body .= "\n"; $Body .= "Other Chairs: "; $Body .= $LROtherChair; $Body .= "\n"; $Body .= "Small Cabinets: "; $Body .= $LRSCabinet; $Body .= "\n"; $Body .= "Large Cabinets: "; $Body .= $LRLCabinet; $Body .= "\n"; $Body .= "Bookcases: "; $Body .= $LRBookcase; $Body .= "\n"; $Body .= "Occassional Tables: "; $Body .= $LROTable; $Body .= "\n"; $Body .= "Coffee Tables: "; $Body .= $LRCTable; $Body .= "\n"; $Body .= "TV Stand: "; // send email $success = mail($EmailTo, $Subject, $Body, "From: ". $FName ." ". $LName ." <". $Email.">"); // redirect to success page if ($success){ header ('Location: thankyou.php'); } else{ header ('Location: error.php'); } Hi
I'm a beginner in php and are facing a problem i cant seem to find the correct solution on. $item5 = $_POST['PIGM1']; if (empty($item5)) { $email_body .= ''; } if (isset($item5)) { $email_body = '<html><head><style type="text/css">td { width: 450; }</style></head><body>'; $email_body .= '<table border="0" width="900">'; $email_body .= '<tr><td><strong>Header in table</strong></td><td></td></tr>'; $email_body .= '<tr><td><strong>Ordered</strong></td><td>' . $item5 . ' pcs. of some item</td></tr>'; $email_body .= '</table><br />'; } Can anyone help me in the right direction? I am trying to send the data entered in to the form to myself and to the user. At the moment I am getting the data sent to myself but cant find the way to send it to the user. I am using this code below <?php mail("webmaster@edgwaretown.co.uk", $subject, $message, $from); ?> How can I get the user to get the data by email as well? Thanks Gary I need this form to be sent to a mail after you press the button and to see the content that is sent , what is the easiest way to do this? http://fhcs.be/ Code: [Select] <?php // Include MySQL class require_once('inc/mysql.class.php'); // Include database connection require_once('inc/global.inc.php'); // Include functions session_start(); $dranken=array(); $DrinkResult=mysql_query("SELECT name,price FROM products" )or die(mysql_error()); while($DrinkRow=mysql_fetch_assoc($DrinkResult)) { $dranken[]=$DrinkRow; } ?> <!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></head> <body> <?php if (!isset($_POST['submit'])) { ?> <form method="post" action="mail.php"> <input type="submit" value="Toon Output" name="submit"/> <?php echo "<table>"; foreach ($dranken as $DrinkRow) { $optionlist = "<select name='{$DrinkRow['name']}_aantal'>"; for($i=0;$i<10;++$i) { $optionlist .= "<option value='$i'>$i</option>"; } $optionlist .= "</select>"; echo "<tr><td>". $DrinkRow['name']."</td><td>".$DrinkRow['price']."</td>"; echo "<td>$optionlist</td></tr>"; } echo "</table>"; ?> </form> <?php } else { echo "<table>"; $totaalPrijs = 0; foreach ($dranken as $DrinkRow) { $aantal = $_POST[ $DrinkRow['name'] . "_aantal"]; if ($aantal > 0) { $prijsperDrank = $aantal * $DrinkRow['price']; echo $DrinkRow['name'] . " : " . $aantal . " Prijs: " . $prijsperDrank . "</br>"; $totaalPrijs=$totaalPrijs + $prijsperDrank; } } if($totaalPrijs>0) { echo " totaal: " .$totaalPrijs; } echo "</table>"; } ?> </body> </html> |