Jump to content

Search the Community

Showing results for tags 'email'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

  1. I've written a basic bash script to test SSMTP, SSMTP works fine, but the script I wrote doesn't send the message correctly clear echo "sending mail" echo "who are you sending it to?" read $to echo echo "excellent, now what is the subject?" read $subject echo echo "marvelous, now write a quick message:" read $message echo To: $to > mail.txt echo From: emailbox >> mail.txt echo Subject: .$subject >> mail.txt echo $message >> mail.txt clear echo "ok, I will send this message for you..." ssmtp $to < mail.txt echo "message sent successfully!" thsi just creates the file without the variables in it for some reason can anyone spot where I've gone wrong? thanks
  2. Hi, not sure if ive posted this in the right section, but im making a website thats mainly html but ive thrown some PHP for the contact us page, i have used a form that requires the user to send a message to an email, ive tested it and i get the message that ive set to show that its sucessfully sent, but when i check my email to see if it has sent well... it hasn't, im new to PHP but do i have to have the site online in order for the message to send?
  3. Hello everyone , I'd like to know if there is some not too hard way to read/parse basic informations in a local file D:/Outlook/outlook.pst. I've check some imap informations such as http://uk3.php.net/manual/en/book.imap.php but I didn't find some easy way to get an email for example or i didn't get how to do it. They talk about imap_open opening local server... But how about a pst file? I guess after parsing won't be easy because .pst file might be not txt file... But do someone has also a clue... Thanks for help. Doctor_No7. www.desgensbien.com
  4. updation in profile using email if a person has a account in a website (may be job portal, or any other site) and that person wants to update his profile in his e-mail account without opening his account on that site(job portal), then what will be the code for updating his information in his email itself ?
  5. When sending email using the mail function in PHP, I can't get the from field to show what I want it to. In the header, I set the from email to be webmaster@mysiteExample.com, but it comes out with somemailboxcode123@mysiteExample.com. How can I fix this? Here's a slightly modified version of my code function email($from, $name, $subject, $body){ $emailFrom="webmaster@mysite.com"; $headers = 'From: Web Form <' . $emailFrom . '>' . "\r\n" . 'Reply-To: ' . $aDifferentEmailAddress . "\r\n" . 'X-Mailer: PHP/' . phpversion(); $send = mail($emailTo, $subject, $body, $headers); }
  6. So I have a form that I've been developing. I originally got the code from htmlDrive.net and have been working on applying it. Basically, I need this HTML form to post to my PHP page and generate/send the posted content into an email. I have been able to get this to work great for single selections but not for multiple selection boxes. Here is my form: <form id="formElem" name="formElem" action="mediaForm.php" method="post"> <fieldset class="step"> <legend>Media Request</legend> <p> <label for="segment">Product Segment: </label> <select name="segment[]" size="4" multiple id="segment"> <option selected> </option> <option>Pedestrian</option> <option>Industrial</option> <option>Security</option> <option>Sensorio</option> </select> </p> <p> <label for="media">Select Media: </label> <select name="media[]" size="4" multiple id="media"> <option selected> </option> <option>Catalog</option> <option>Media Kit</option> <option>Technical Binder</option> <option>General Information CD</option> </select> </p> <p> <label for="print">Printed Publication </label> <input name="print" type="checkbox" id="print"> </p> <p> <label for="digital">Digital Publication </label> <input name="digital" id="digital" type="checkbox"> </p> </fieldset> <fieldset class="step"> <legend>Personal Info</legend> <p> <label for="company">Company: </label> <input id="company" name="company" placeholder="ABC Automatics" AUTOCOMPLETE = "on" /> </p> <p> <label for="title">Job Title: </label> <input id="title" name="title" placeholder="President" AUTOCOMPLETE = "on" /> </p> <p> <label for="firstName">First Name: </label> <input id="firstName" name="firstName" placeholder="John" AUTOCOMPLETE = "on" /> </p> <p> <label for="lastName">Last Name: </label> <input id="lastName" name="lastName" placeholder="Smith" AUTOCOMPLETE = "on" /> </p> <p> <label for="customerType">Customer Type: </label> <select name="customerType[]" size="4" multiple id="customerType"> <option selected> </option> <option>Wholesale</option> <option>Distributor</option> <option>Architect</option> <option>Technician</option> <option>Sales</option> <option>End User</option> <option>Other</option> </select> <br> </p> <p> If you do not know your type, please choose "Other." </p> </fieldset> <fieldset class="step"> <legend>Contact Info</legend> <p> <label for="email">Email: </label> <input id="email" name="email" placeholder="jsmith@ABC_Auto.com" type="email" AUTOCOMPLETE = "on" /> </p> <p> <label for="phone">Phone Number: </label> <input id="phone" name="phone" placeholder="xxx-xxx-xxxx" type="tel" AUTOCOMPLETE = "on" /> </p> <p> <label for="address">Address: </label> <input id="address" name="address" placeholder="123 Enterprise Ln" AUTOCOMPLETE = "on" /> </p> <p> <label for="city">City: </label> <input id="city" name="city" placeholder="City Name" AUTOCOMPLETE = "on" /> </p> <p> <label for="state">State: </label> <input id="state" name="state" placeholder="ST" AUTOCOMPLETE = "on" /> </p> <p> <label for="zipcode">Zipcode: </label> <input id="zipcode" name="zipcode" placeholder="12345" AUTOCOMPLETE = "on" /> </p> <p> <label for="country">Country: </label> <select id="country" name="country"> <option selected> </option> <option>United States</option> <option>Mexico / Latin America</option> <option>Canada</option> <option>Other</option> </select> </p> </fieldset> <fieldset class="step"> <legend>Comments</legend> <p> <label for="comments"></label> <textarea name="comments" id="comments" placeholder="Insert additional comments here"></textarea> </p> </fieldset> <fieldset class="step"> <legend>Confirm</legend> <p> Everything in the form was correctly filled if all the steps have a green checkmark icon. A red checkmark icon indicates that some field is missing or filled out with invalid data. In this last step the user can confirm the submission of the form. </p> <p class="submit"> <button id="registerButton" type="submit" value="submit">Submit</button> </p> </fieldset> </form> My PHP: <?php if(isset($_POST['email'])) { $email_to = "email@yoursite.com"; $email_subject = "Media Request Form"; $segment = $_POST['segment']; $media = $_POST['media']; $print = $_POST['print']; $digital = $_POST['digital']; $company = $_POST['company']; $title = $_POST['title']; $firstName = $_POST['firstName']; $lastName = $_POST['lastName']; $customerType = $_POST['customerType']; $email = $_POST['email']; $phone = $_POST['phone']; $address = $_POST['address']; $city = $_POST['city']; $state = $_POST['state']; $zipcode = $_POST['zipcode']; $country = $_POST['country']; $comments = $_POST['comments']; $email_message = "Form details below.\n\n"; function clean_string($string) { $bad = array("content-type","bcc:","to:","cc:","href"); return str_replace($bad,"",$string); } $email_message .= "Company: ".clean_string($company)."\n"; $email_message .= "Title: ".clean_string($title)."\n"; $email_message .= "Name: ".clean_string($firstName)." ".clean_string($lastName)."\n"; $email_message .= "Type: ".clean_string($customerType)."\n\n"; $email_message .= "Email: ".clean_string($email)."\n"; $email_message .= "Phone: ".clean_string($phone)."\n"; $email_message .= "Address: ".clean_string($address)."\n"; $email_message .= "City: ".clean_string($city)."\n"; $email_message .= "State: ".clean_string($state)."\n"; $email_message .= "Zipcode: ".clean_string($zipcode)."\n"; $email_message .= "Country: ".clean_string($country)."\n\n"; $email_message .= "Segment: ".clean_string($segment[])."\n"; $email_message .= "Media Type: ".clean_string($media)."\n"; $email_message .= "Printed Copy: ".clean_string($print)."\n"; $email_message .= "Digital Copy: ".clean_string($digital)."\n\n"; $email_message .= "Comments: ".clean_string($comments)."\n\n"; // create email headers $headers = 'From: '.$email."\r\n". 'Reply-To: '.$email."\r\n" . 'X-Mailer: PHP/' . phpversion(); @mail($email_to, $email_subject, $email_message, $headers); ?> <!-- include your own success html here --> Thank you for contacting us. We will be in touch with you very soon. <?php } ?> My multiple selectors are not showing up correctly. They are only outputting "array" for the content. Any help would be much appreciated! Thanks!
  7. Good Day All, I am very new to the php arena. I would please like some step by step assistance to setup a mailer for my local intranet(not hosted for internal use). If anyone has some advice I would appreciate it. I have searched the net, tried to load other code but get to the point where the feedback form will take me back to the home page but doesn't send the mail with no errors or warnings. Thanks in advance,
  8. Hi all, I want to echo two variables inside the body of automatic email. i am trying to get those two variables from the form that customer just submitted. i am posting my code below, please help ASAP. Thanks in advance <?php if(isset($_POST['button_pressed'])) { $to=$Email; $subject='Hi There!!'; $body='Hi'; $Title . '' . $Surname; ', This is a demo email sent using PHP on XAMPP'; if (mail($to,$subject,$body)){ echo 'Mail sent successfully!'; } else{ echo 'Mail not sent!'; }} ?>
  9. Hi everyone, I am working on a site, that will allow dentist, doctors and the like to set up automated E-Mail reminders for their clients, instead of having to call them. I am relatively comfortable in php. But I have never done anything with E-Mail before... My main question has to do with sending E-Mail on a specific date. I have seen a few ways to do it, but nothing that really seems desirable. One way, seemed to require that someone be using the site, to send the E-mail. Ie: if an E- mail is supposed to be sent at 6, but no one logs on until 7:30. Then that E-mail won't be sent until 7:30. The other method that I have seen used cron, this second method, seems superior but much more complicated. What method should I use??? Any, hits/tips to get me on the right direction would be appreciated! Thanks, Josh
  10. Hi everybody can someone help me to make an email validtion system in my code, and help me find a way to check if the username is taken, and if possible where i should put the code in, im new in this and i find it very hard Here is my registration site <?php session_start();session_destroy(); session_start(); if($_GET["Brugernavn"] && $_GET["Email"] && $_GET["Password1"] && $_GET["Password2"] ) //tjekker alle data { if($_GET["Password1"]==$_GET["Password2"]) //Her tjekker jeg at begge indtastede password er ens { $Server="localhost"; $Brugernavn="root"; $conn= mysql_connect($Server,$Brugernavn)or die(mysql_error()); mysql_select_db("test",$conn); //Her opretter jeg en forbindelse til databasen $sql="insert into Brugere (Brugernavn,Email,Password)values('$_GET[brugernavn]','$_GET[Email]','$_GET[Password1]')"; //Her indsætter jeg de indtastede værdier ind i tabellen i min database $result=mysql_query($sql,$conn) or die(mysql_error()); echo "<h1>Du er nu blevet registreret</h1>"; //Hvis alt passer kommer teksten "Du er nu osv." frem echo "<a href='Startside.php'>Gå til startside</a>"; //Hvis alt passer kommer der et link der sender brugeren til startsiden } else echo "Passwordende passer ikke sammen, prøv igen"; //Hvis passwordne ikke passer, udskriver jeg teksten "Passwordende passer osv." } else echo"Data er fucked"; ?>
  11. Hello, I am new to mysqli and have a little question. I have tried to find an alternative for a while now but nothing seems to work... maybe somebody could help. So my old code is this function ($email) { $query = mysql_query("SELECT COUNT(`user_id`) FROM users WHERE email = '$email'")or die (mysql_error()); return (mysql_result($query, 0) == 1) ? true : false; } after that the function is used like this : if (login_email_exists($mysqli,$_POST['email']) === true) { $errors[] = 'Sorry this email adress is already in use.'; } And my new code is this function ($mysqli,$email) { $query = $mysqli->query("SELECT COUNT(`user_id`) FROM users WHERE email = '$email'")or die (mysql_error()); return ($query == 1) ? true : false; } Now it seems to always go wrong when I want to check the result and return if it's true or false. If anybody can find an answer or alternative to my problem I would be very happy.
  12. Hi Guys, I am trying to create a script which send a customer an invoice when they place an order. I have written the following code and this works when sent to an email address which is opened using gmail or the iPhone email client, but Microsoft Outlook screams a great big no at me, and just shows me the html in plain text. Any thoughts anyone? I have included the code below: <?php include("includes/conn.php"); $id=1; $random_hash = md5(date('r', time())); $subject="Red Van Tool Sales - Invoice: "; $headers = "From: sales@redvantoolsales.co.uk" . "\r\n"; $headers .= 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=utf-8' . "\r\n"; /*$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null; $user=isset($_COOKIE['user']) ? $_COOKIE['user'] : null; $sql="select * from user where user_email='$user'"; $sql_res=mysqli_query($conn, $sql) or die(mysqli_error($conn)); while($array=mysqli_fetch_array($sql_res)) { $uid=$array['user_id']; } */ $sql="select * from orders inner join payment_options on orders.payment_options_id=payment_options.payment_options_id inner join postage_options on orders.delivery_id=postage_options.postage_options_id inner join user_address on orders.delivery_address_id=user_address.user_address_id inner join user on orders.user_id=user.user_id where orders.orders_id='$id'"; $sql_res=mysqli_query($conn, $sql) or die(mysqli_error($conn)); $count=mysqli_num_rows($sql_res); if($count==0) { //header("Location:noauth.php"); echo "fail"; } else { while($array=mysqli_fetch_array($sql_res)) { $order_id=$array['orders_id']; $subject .= $order_id; $order_date=date("d/m/Y", $array['orders_date']); $orders_total=number_format($array['orders_total'],2); $order_subtotal=number_format($orders_total/1.2,2); $vat=number_format($orders_total-$order_subtotal,2); $shipping_total=number_format($array['shipping_total'],2); $payment_fee=number_format($array['payment_fee'],2); $payment_options_name=$array['payment_options_name']; $postage_options_name=$array['postage_option_name']; $user_forename=$array['user_forename']; $user_surname=$array['user_surname']; $address_address=$array['address_address']; $address_city=$array['address_city']; $address_postcode=$array['address_postcode']; $shipping_time=$array['postage_option_shipping_time']; $shipping_time = $shipping_time*86400; $expected_arrival=$array['orders_date']+$shipping_time; $expected_arrival=date("d/m/Y", $expected_arrival); $emailto = $array['user_email']; } } ob_start(); //Turn on output buffering ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <link rel="stylesheet" type="text/css" href="http://www.redvantoolsales.co.uk/invoice.css" media="print"> <link rel="stylesheet" type="text/css" href="http://www.redvantoolsales.co.uk/invoice.css" media="screen"> </head> <body> <div id="cont"> <div id="container"> <div id="topbar"> <img class="logo" src="http://www.redvantoolsales.co.uk/images/logo.png"> <div id="companyaddress">Red Van Tools<br>Address<br>City<br>Postcode<br>VAT: 000000000<br>sales@redvantoolsales.co.uk<br>01633 000000<br>www.redvantoolsales.co.uk</div> </div> <div id="nextbar"> <div id="customeraddress"><?php echo $user_forename . " " . $user_surname; ?><br><?php echo $address_address; ?><br><?php echo $address_city; ?><br><?php echo $address_postcode; ?></div> <div id="invoicedetail">INVOICE <?php echo $order_id; ?><br><?php echo $order_date; ?></div> </div> <div id="orderdetailbar"> <table> <tr><th width="333">Payment Method</th><th width="333">Order Date</th><th width="333">Estimated Delivery Date</th></tr> <tr><td><?php echo $payment_options_name; ?></td><td><?php echo $order_date; ?></td><td><?php echo $expected_arrival; ?></td></tr> </table> </div> <div id="orderitembar"> <table> <tr><th width="120">Quantity</th><th width="500">Details</th><th width="120">Unit Price (£)</th><th width="120">VAT</th><th width="120">Net Subtotal (£)</th></tr> <?php $sql="select * from order_item inner join products on order_item.product_id=products.product_id inner join price on products.product_id=price.product_id where orders_id='$id'"; $sql_res=mysqli_query($conn, $sql) or die(mysqli_error($conn)); while($array=mysqli_fetch_array($sql_res)) { $total = number_format($array['product_price']*$array['product_qty'],2); echo "<tr><td>" . $array['product_qty'] . "</td><td>" . $array['product_name'] . "</td><td>" . number_format($array['product_price'],2) . "</td><td>20%</td><td align=\"right\">" . $total . "</td></tr>"; } ?> </table> </div> <div id="totals"> <table> <tr><td>Net Total</td><td><?php echo $order_subtotal; ?></td></tr> <tr><td>VAT</td><td><?php echo $vat; ?></td></tr> <tr><td><b>GBP Total</b></td><td><b>£<?php echo $orders_total; ?></b></td></tr> </table> </div> </div> </div> </body> </html> <?php $message1 = ob_get_clean(); mail( $emailto, $subject, $message1, $headers ); ?> Thanks guys!
  13. I'm trying to include a checkbox group in a form submission. The user can check one, two, or all three of the choices. I need only the checked boxes to appear in the e-mail to the admin. I understand I need to do some kind of an array, but don't know how. Here is the checkbox group code: <input type="checkbox" name="CheckboxGroup1[]" value="Choice1" id="1" />Select choice 1 <input type="checkbox" name="CheckboxGroup1[]" value="Choice2" id="2" />Select choice 2 <input type="checkbox" name="CheckboxGroup1[]" value="Choice3" id="3" />Select choice 3 And here is the line in the script: $mail_body .= "Choices: ".$_REQUEST['CheckboxGroup1']; I will also attach the entire script. Any help? THANKS! sendformContact_test.php
  14. Hi, I have a page that was custom written by a developer some time ago, the page has an email entry text area which currently has some form of checking on it but as to how it works I do not know! The code is as follows :- //Add E-mail Address $sql6 = "SELECT email FROM carts WHERE cartid='".$cart."'"; $result6 = mysql_query($sql6); $emailaddress = ''; while ( $row6 = @mysql_fetch_array($result6, MYSQL_BOTH) ) { $addemail .= ' <form method="post" action="cart2.php" name="emailform"> '; $addemail .= ' E-mail Address: <input type="text" style="background:#cfc" "border-color": "#0c0" name="email" value="'.$row6['email'].'" size="19" /><input type="hidden" name="cartid" value="'.$cart.'" />'; if ( $emailerror != '' ) { $addemail .= '<img src="images/email_error.png" width="16" height="16" hspace="4" alt="E-mail Error" />'; } $addemail .= ' <input type="image" name="Add E-mail Address" alt="Add E-mail Address" src="images/confirmemail.gif" style="vertical-align:middle" /> </form> '; if ( $row6['email'] == '' ) { $emailpresent = 0; } else { $emailpresent = 1; } } $addemail .= ' </td> </tr> '; } ?> The text input box has a green background, if the email address is invalid the page reloads but an error image appears next to the text box. What I'd also like to do is if this happens change the colour of the text box. Is this possible? I'm not a programmer, just trying to get my way through this. Thanks for any help
  15. Hi fellow geeks I need some help in creating my first website. I am stuck with email validation, I have checked plenty of links from google but I am just not able to get through with email validation. I would be greatful if you can help me with it. This is the code where I am facing issues.. if(preg_match('/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/',$eml)) { die("invalid email address"); $flag=false; } now whenever I try inserting a valid email address, it pops up an error as: Warning: preg_match() [function.preg-match]: No ending delimiter '^' found in C:\xampp\htdocs\cms_xhtml\customerinsert.php on line 159 please give me a solution to this issue or give me some other email validation code which can replace the above mentioned code. Thank you again, gracias
  16. can you one of the php master can help me out with this this is my array output Array ( [0] => WI BLACK CHERRY BASE [1] => 1 [2] => WI STRAWBERRY BASE [3] => 1 ) this is the buttom I am using to past the value <form id="form1" name="form1" method="post" action="/storescripts/mailcart.php"> <input type="hidden" name="message" id="message" value="<?php echo $mail_id_array; ?>" /> <input type="submit" name="button" id="button" value="Send Order" /> </form> this is the mailcart.php <?php $message = ''; $name = "wesrt"; $email = "abc@hotmail.com"; $message .= $_POST[message]; $formcontent=" From: $name \n Message: $message"; $recipient = "info@xsn.com"; $subject = "Order Form"; $mailheader = "From: $email \r\n"; //mail($recipient, $subject, $formcontent, $mailheader) or die("Error!"); mail($recipient, $subject, $message, $mailheader) or die("Error!"); print_r($message); //header( 'Location: http://www.xsn.com/index.php' ) ; //echo "Thank You!"; ?> I am getting this: WI BLACK CHERRY BASE .--->.1<br>WI STRAWBERRY BASE .--->.1<br> and I would like to have the following result: WI BLACK CHERRY BASE .--->.1 WI STRAWBERRY BASE .--->.1
  17. Right so i'm trying to make a subscribe page at the moment for my website. I've got a section that's listed be the first one to see it here...from there i wanted to make a text box for the user to type their email address and then a button to submit and send me an email of the users email address. Also, I wanted to make the submit button my own graphic and not just a button? The HTML code is: <form class="email" action="mailer.php" method="post"> <input name="email" type="text" size="70" /> <input class="send" type="submit" value="Send"> </form> and the PHP: <?php /* Set e-mail recipient */ $myemail = "cweyer@hotmail.co.uk"; /* Check all form inputs using check_input function */ $email = check_input($_POST['email']); /* If e-mail is not valid show error message */ if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/", $email)) { show_error("E-mail address not valid"); } /* Send the message using mail() function */ mail($myemail); /* Redirect visitor to the thank you page */ header('Location: thanks.html'); exit(); /* Functions we used */ function check_input($data, $problem='') { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); if ($problem && strlen($data) == 0) { show_error($problem); } return $data; } function show_error($myError) { ?> <html> <body> <p>Please correct the following error:</p> <strong><?php echo $myError; ?></strong> <p>Hit the back button and try again</p> </body> </html> <?php exit(); } ?> If anyone could help it would be so appreciated! To get more of an idea on my problem, visit www.itscharlottesweb.co.uk
  18. Hey. I'm having some troubles with a php script I got a while ago for form to email on a website i'm currently working on. The client has recently switched to a different hosting server and they require SMTP authentication for the new cloudsites....I have about 5 different pretty detailed forms that i need to have the SMTP authentications placed into, but i have no idea what i'm doing. below is my current coding. i'm just not sure how to place the SMTP into the coding correctly. i've seen that i need to download swift or pear and i have no clue where to start. any help or direction would be greatly appreciated...thanks. the current PHP script for my form to email: <?php $my_email = "studio@roharikproductions.com"; /* Enter the continue link to offer the user after the form is sent. If you do not change this, your visitor will be given a continue link to your homepage. If you do change it, remove the "/" symbol below and replace with the name of the page to link to, eg: "mypage.htm" or "http://www.elsewhere.com/page.htm" */ $continue = "index.html"; /* Step 3: Save this file (FormToEmail.php) and upload it together with your webpage containing the form to your webspace. IMPORTANT - The file name is case sensitive! You must save it exactly as it is named above! Do not put this script in your cgi-bin directory (folder) it may not work from there. THAT'S IT, FINISHED! You do not need to make any changes below this line. */ $errors = array(); // Remove $_COOKIE elements from $_REQUEST. if(count($_COOKIE)){foreach(array_keys($_COOKIE) as $value){unset($_REQUEST[$value]);}} // Check all fields for an email header. function recursive_array_check_header($element_value) { global $set; if(!is_array($element_value)){if(preg_match("/(%0A|%0D|\n+|\r+)(content-type:|to:|cc:|bcc:)/i",$element_value)){$set = 1;}} else { foreach($element_value as $value){if($set){break;} recursive_array_check_header($value);} } } recursive_array_check_header($_REQUEST); if($set){$errors[] = "You cannot send an email header";} unset($set); // Validate email field. if(isset($_REQUEST['email']) && !empty($_REQUEST['email'])) { if (empty($_POST['email2']) || $_POST['email2'] != $_POST['email']){$errors[] = "Email addresses do not match.";} if(preg_match("/(%0A|%0D|\n+|\r+|:)/i",$_REQUEST['email'])){$errors[] = "Email address may not contain a new line or a colon";} $_REQUEST['email'] = trim($_REQUEST['email']); if(substr_count($_REQUEST['email'],"@") != 1 || stristr($_REQUEST['email']," ")){$errors[] = "Email address is invalid";}else{$exploded_email = explode("@",$_REQUEST['email']);if(empty($exploded_email[0]) || strlen($exploded_email[0]) > 64 || empty($exploded_email[1])){$errors[] = "Email address is invalid";}else{if(substr_count($exploded_email[1],".") == 0){$errors[] = "Email address is invalid";}else{$exploded_domain = explode(".",$exploded_email[1]);if(in_array("",$exploded_domain)){$errors[] = "Email address is invalid";}else{foreach($exploded_domain as $value){if(strlen($value) > 63 || !preg_match('/^[a-z0-9-]+$/i',$value)){$errors[] = "Email address is invalid"; break;}}}}}} } // Check referrer is from same site. if(!(isset($_SERVER['HTTP_REFERER']) && !empty($_SERVER['HTTP_REFERER']) && stristr($_SERVER['HTTP_REFERER'],$_SERVER['HTTP_HOST']))){$errors[] = "You must enable referrer logging to use the form";} // Check for a blank form. function recursive_array_check_blank($element_value) { global $set; if(!is_array($element_value)){if(!empty($element_value)){$set = 1;}} else { foreach($element_value as $value){if($set){break;} recursive_array_check_blank($value);} } } recursive_array_check_blank($_REQUEST); if(!$set){$errors[] = "You cannot send a blank form";} unset($set); // Display any errors and exit if errors exist. if(count($errors)){foreach($errors as $value){print "$value<br>";} exit;} if(!defined("PHP_EOL")){define("PHP_EOL", strtoupper(substr(PHP_OS,0,3) == "WIN") ? "\r\n" : "\n");} // Build message. function build_message($request_input){if(!isset($message_output)){$message_output ="";}if(!is_array($request_input)){$message_output = $request_input;}else{foreach($request_input as $key => $value){if(!empty($value)){if(!is_numeric($key)){$message_output .= str_replace("_"," ",ucfirst($key)).": ".build_message($value).PHP_EOL.PHP_EOL;}else{$message_output .= build_message($value).", ";}}}}return rtrim($message_output,", ");} $message = build_message($_REQUEST); $message = $message . PHP_EOL.PHP_EOL."-- ".PHP_EOL.""; $message = stripslashes($message); $subject = "Business Headshot Booking Form"; $headers = "From: " . $_REQUEST['email']; mail($my_email,$subject,$message,$headers); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style type="text/css"> body,td,th { color: #7F7F7F; font-family: inheirit; } a:link { color: #7F7F7F; text-decoration: none; } a:visited { text-decoration: none; color: #7F7F7F; } a:hover { text-decoration: underline; color: #7F7F7F; } a:active { text-decoration: none; color: #7F7F7F; } body p { font-size: 16px; } body p { font-size: 24px; } body p { text-align: center; } </style> </head> <body bgcolor="#e2e2e2" text="#7F7F7F" link="#7F7F7F" vlink="#7F7F7F" alink="#7F7F7F"> <div> <center> <b>Thank you <?php print stripslashes($_REQUEST['name']); ?></b> <br>Your message has been sent <p><a href="http://columbusbusinessheadshots.com/">Click here to continue</a></p> </center> </div> </body> </html> i tried to add this into the code in hopes of a quick fix but that made the form not work at all: $host = "host@host.com"; $username = "email@host.com"; $password = "emailpassword"; $smtp = Mail::factory('smtp', array ('host' => $host, 'auth' => true, 'username' => $username, 'password' => $password)); i'm not sure if i add that just anywhere into the php script or if it needs to be in a certain area? also not sure what exactly i'll need to install or download onto the server as well. thanks.
  19. contact form weird I could receive the email but my php has some problem which makes the receving email looks strange, and can't use reply function on outlook. anyone could help me improve it. thank you. this contact.php <body> <?php $field_firstname = $_POST['firstname'];" ".$_POST['lastname']; $field_emailaddress= $_POST['emailaddress']; $field_telepohone = $_POST['telephone']; $field_country = $_POST['country']; $field_business = $_POST['business']; $field_comments = $_POST['comments']; $mail_to = 'info@ABC.com'; $subject = 'Message from a site visitor '.$field_name; $body_message = 'From: '.$field_name."\n"; $body_message .= 'E-mail: '.$_POST['emailaddress']."\n"; $body_message .= 'Message: \n'.$_POST['emailaddress']."\n"; $body_message .= $_POST['telephone']."\n"; $body_message .= $_POST['country']."\n"; $body_message .= $_POST['business']."\n"; $body_message .= $_POST['comments']; $headers = 'From: '.$_POST['emailaddress'].'\r\n'; $headers .= 'Reply-To: '.$_POST['emailaddress'].'\r\n'; $mail_status = mail($mail_to, $subject, $body_message, $headers); if ($mail_status) { ?> <script language="javascript" type="text/javascript"> alert('Thank you for the message. We will contact you shortly.'); <!-- window.location.href = "http://www.ABC.com/thankyou.html"; //--> </script> <?php } else { ?> <script language="javascript" type="text/javascript"> alert('Message failed. Please check the items required'); <!-- window.location.href = "http://www.ABC.com/contact.html"; //--> </script> <?php } ?> this is contact.html <form action="contact.php" method="post" name="form1" target="_blank" class="email" id="form1" onsubmit="MM_validateForm('firstname','','R','lastname','','R','emailaddress','','NisEmail','comments','','R');return document.MM_returnValue"> <p>If you need more information about our inspection, sourcing, auditing, and verification service, <br /> <br /> pls contact below address or just fill in the form below, our customer service will get you back <br /> <br /> as soon as possible. thank you for considering ABC!</p> <p>First Name: <label for="firstname"></label> <input type="text" name="firstname" id="firstname" /> <br /> <br /> Lsat Name: <label for="lastname"></label> <input type="text" name="lastname" id="lastname" /> <br /> <br /> Email Address: <label for="emailaddress"></label> <input type="text" name="emailaddress" id="emailaddress" /> <br /> <br /> Telephone: <label for="telephone2"></label> <input type="text" name="telephone" id="telephone" /> <label for="TEL"></label> <br /> <br /> Country: <label for="country"></label> <select name="country" id="country"> <option>Australia</option> <option>Austria</option> <option>Belgium</option> <option>Czech Republic</option> <option>Denmark</option> <option>Finland</option> <option>France</option> <option>Germany</option> <option>Greece</option> <option>Hungary</option> <option>Italy</option> <option>Netherlands</option> <option>Norway</option> <option>Poland</option> <option>Romania</option> <option>Russia</option> <option>Spain</option> <option>Sweden</option> <option>Switzerland</option> <option>United Kingdom</option> <option>Canada</option> <option>Mexico</option> <option>United States of America</option> <option>Argentina</option> <option>Brazil</option> <option>New Zealand</option> <option>Egypt</option> <option>Iran</option> <option>Israel</option> <option>Kuwait</option> <option>Saudi Arabia</option> <option>Turkey</option> <option>Japan</option> <option>South Korea</option> <option>Vietnam</option> <option>other</option> </select> <br /> <br /> Business: <label for="business"></label> <select name="business" id="business"> <option>wholesale</option> <option>retail</option> <option>industrial</option> <option>services</option> <option>distributor</option> <option>manufacturer</option> <option>importer</option> <option>other</option> </select> <label for="telephone"></label> <label for="FAX"></label> <br /> <br /> Comments:<br /> <br /> <label for="comments"></label> <textarea name="comments" id="comments" cols="45" rows="5"></textarea> <br /> <br /> <input name="submit" type="submit" id="submit" onclick="MM_validateForm('firstname','','R','lastname','','R','emailaddress','','RisEmail','telephone','','NisNum','comments','','R');return document.MM_returnValue" value="Submit" /> <br /> </p> </form> another problem is that the verification function doesn't work, people could send me blank email, but when I try myself, it works. thank you for you help.
  20. Hi there! I have only just started making my first page and have thrown myself in the deep end as it seems. My contact page has turned out quite professional but I keep receiving error messages after 'sent'. Previously from my localhost test server the emails did get sent but I did also receive the error message - now, from my remote server (GoDaddy) it does not get sent at all and the error is still there! I receive the following error: Warning: mail() [function.mail]: SMTP server response: 451 See http://pobox.com/~djb/docs/smtplf.html. in D:\hosting\12345678\html\contact-page.php on line 54 this is referring to: // if validation passed ok then send the email mail($email_to, $email_subject, $email_content); It seems as if it tries to contact a 3rd party server but I seriously don't have any idea where I can adjust that in my script :-\ I have searched and adjusted some things but simply cannot find the actual issue...anyone here who can help me please? Thanks x
  21. Hello, I m using the following to check on bad words upon an email validation: $badWords=array('...','...'); $words = array_map('preg_quote', $badWords); $words1 = implode('|', $words); if(!preg_match('/^[a-z0-9_\-\.]+@(?:[a-z0-9_\-]+\.)+(?:'.$Ext.')+$/', $user_email) || preg_match('/\b'.$words1.'\b/i', $user_email){} The email in question: ericbass213...why is it considering it as badword since it snot listed in the badwords array and yes when I ve disabled the badword validation the email workd fine. Thank
  22. I have a rather bizarre problem with a script I use for sending automated emails. The script is: <?php $formSubmitted = isset($_POST['submitted']); $submitSuccess = false; if (formSubmitted) { function spam_scrubber($value) { $very_bad = array('to:','cc:','bcc:','content-type:','mime-version:','multipart-mixed:','content-transfer-encoding:'); foreach ($very_bad as $v) { if(stripos($value,$v) !== false) return ''; } return trim(strip_tags($value)); }//end of spam_scrubber $scrubbed = array_map('spam_scrubber',$_POST); if (!empty($scrubbed['customerName']) && !empty($scrubbed['customerQuery']) && (!empty($scrubbed['phone']) || !empty($scrubbed['emailAddress']))) { $submitSuccess = true; if (!empty($scrubbed['emailAddress'])) { $emailAddress = $scrubbed['emailAddress']; if (!strstr($emailAddress,'@') || !strstr($emailAddress,'.')) { $submitSuccess = false; } } if ($submitSuccess) { $body = "Customer's name: {$scrubbed['customerName']}\nCustomer's phone number: {$scrubbed['phone']}\nCustomer message: {$scrubbed['customerQuery']}"; $body = wordwrap($body,70); $from = "no-reply@lbi-beach-house.com"; if (!empty($scrubbed['emailAddress'])) { $from = $scrubbed['emailAddress']; } mail('my@emailaddress.com','Message via website from ' . $scrubbed['customerName'],$body,"From: ".$from); header( 'Location: thank-you.php' ) ; } } }//end of formSubmitted ?> The problem is with the emailAddress submitted. During testing, if I use an email address from the domain @wsgfl.org.uk then the script fails to send the email (yet it redirects to the thank-you page). It's bizarre because I only have to change the submitted domain by one letter and it works. It seems to have nothing to do with the length of the address or the number of dots in the address. Anyone got any ideas? I've checked my spam filter - it's not that! Many thanks for your advice in advance.
  23. Thank you for the help thus far everyone! I have updated my code with the help of reqinix. Now I have this error: Error: Query was empty Brief - I want the user to enter their eMail into the form and submit it to signup.php; the PHP file will do the following: Generate a random User_ID that is 16 characters long. Check the database to make sure the Unque_ID does not exist. If it does exists the script will generate another random User_ID and attempt again . If it does NOT exist the PHP script will continue. Check the database to make sure the eMail does not exists. If it does exists the fuction will not create a new account and displays "eMail already exists." If it does NOT exists then the script will continue. The PHP script will add the informtion to the table named "eMail" as a new entry. Here is the updated script with requinix's help: <?php $con = mysql_connect("localhost","******","******"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("diamon79_mysql", $con); function generateRandomString($Generate_ID = 16) { return substr(str_shuffle("01234567890123456789"), 0, $Generate_ID); } $searchquery = "SELECT * FROM eMail WHERE `User_ID` = '$Generate_ID'"; $searchresult = mysql_query($searchquery) or die(mysql_error()); if (mysql_num_rows($searchresult) == 0) { $User_Id = $Generate_ID; eMailCheck(); } // no rows found else { generateRandomString(); } function eMailCheck() { $eMail = "$_POST[eMail]"; return $eMail; } $searcheMailquery = "SELECT * FROM eMail WHERE `eMail` = '$eMail'"; $searcheMailresult = mysql_query($searcheMailquery) or die(mysql_error()); if (mysql_num_rows($searcheMailresult) == 0) { PostInformation(); } // no rows found else { echo "eMail already exists"; } function PostInformation() { $sql="INSERT INTO eMail (User_D, eMail) VALUES ('$User_ID','$_POST[eMail]')"; } if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "1 record added"; mysql_close($con); ?>
  24. Thank you to everyone who is taking the time to read my post and help me. Brief - I want the user to enter their eMail into the form and submit it to signup.php; the PHP file will do the following: Generate a random User_ID that is 16 characters long. Check the database to make sure the Unque_ID does not exist. If it does exists the script will generate another random User_ID and attempt again . If it does NOT exist the PHP script will continue. Check the database to make sure the eMail does not exists. If it does exists the fuction will not create a new account and displays "eMail already exists." If it does NOT exists then the script will continue. The PHP script will add the informtion to the table named "eMail" as a new entry. I keep getting this error: Parse error: syntax error, unexpected T_FUNCTION in /home/diamon79/public_html/signup.php on line 12 Line 12 is function generateRandomString($User_ID = 16) { The form to submit content: <form action="signup.php" method="post"> eMail: <input type="text" name="eMail"> <input type="submit"> </form> The PHP script the form is posted to: <?php $con = mysql_connect("localhost","*********","*******"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("diamon79_mysql", $con); $eMail == '$_POST[eMail]' function generateRandomString($User_ID = 16) { return substr(str_shuffle("0123456789"), 0, $User_ID); } $searchquery = "SELECT * FROM eMail WHERE `Column_A` = '$User_ID'"; $searchresult = mysql_query($searchquery) or die(mysql_error()); if (mysql_num_rows($searchresult) == 0) { eMailCheck(); } // no rows found else { generateRandomString($User_ID = 16); } function eMailCheck() $searcheMailquery = "SELECT * FROM eMail WHERE `Column_B` = '$eMail'"; $searcheMailresult = mysql_query($searcheMailquery) or die(mysql_error()); if (mysql_num_rows($searcheMailresult) == 0) { PostInformation(); } // no rows found else { echo "eMail already exists"; } function PostInformation() $sql="INSERT INTO eMail (User_ID, eMail) VALUES ('$User_ID','$_POST[eMail]')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "1 record added"; mysql_close($con); ?> I downloaded Notepad++ to be able to debug the script, but I cannot figure out how to use it properly so I am posting here. Thank you. Brett Hartel
  25. Hello All, If I have a newsletter process script with name and email, is there a way to identify if the email is an email address? For example johndoe@gmail.com. I kind of want to think of a way to identify if it is a real name as well. Maybe just ask for first and last name. Thanks,
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.