Jump to content

jalen

Members
  • Posts

    68
  • Joined

  • Last visited

    Never

Everything posted by jalen

  1. madtechie, this code works on my hosting site: but not local environment, on local environment i always get this error: Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\Apache\htdocs\FormToEmail.php on line 89 failed <html> <head> <title>Untitled 2</title> </head> <body> <form action="FormToEmail.php" method="post"> <table border="1" bgcolor="#ececec" cellspacing="5"> <tr><td>Email address</td><td><input type="text" size="30" name="my_email"></td></tr> <tr><td>Name</td><td><input type="text" size="30" name="name"></td></tr> <tr><td>Email address</td><td><input type="text" size="30" name="email"></td></tr> <tr><td valign="top">Comments</td><td><textarea name="comments" rows="6" cols="30"></textarea></td></tr> <tr><td> </td><td><input type="submit" value="Send"><font face="arial" size="1"> <a href="http://FormToEmail.com">Form Mail</a> by FormToEmail.com</font></td></tr> </table> </form> </body> </html> <?php ini_set("display_errors", "1"); error_reporting(E_ALL); $my_email = 'abpple@yahoo.com'; $errors = array(); // Check for a blank form. //function recursive_array_check_blank($element_value) function blank($fillin) { //is_array — Finds whether a variable is an array global $set; if(!is_array($fillin)){ if(!empty($fillin)){ $set = 1; } }else{ foreach($fillin as $value){ if($set){ break; } blank($value); } } } 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; } // Build message. function Comment_text($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)).": ".Comment_text($value).PHP_EOL.PHP_EOL; }else{ $message_output .= Comment_text($value).", "; } } } }return rtrim($message_output,", "); } $message = Comment_text($_REQUEST); $message = stripslashes($message); $subject = "Comment have been added to your YYTgen contribution report!"; $headers = "From: " . $_REQUEST['email']; if (mail($my_email,$subject,$message,$headers)) { echo "sent"; }else{ echo "failed"; } ?> <html> <head> <title>Form To Email PHP script from FormToEmail.com</title> </head> <body bgcolor="#ffffff" text="#000000"> <div> <center> <b>Thank you <?php print stripslashes($_REQUEST['name']); ?></b> <br>Your message has been sent </center> </div> </body> </html>
  2. I like to get local environment to work is because I like to do testing, is easier to do testing this way.
  3. madtechie walk me through on how to get it to work
  4. what do you mean and how? and how can I get my local environment to work?
  5. this code on the bottom I uploaded to my hosting site, and uploaded my php ini files and it work, the mailing went through. The only thing is that on my local host it doesn't work, and when I put this, it gives me an error message error_reporting(E_ALL); so i don't know why your code gives nothing, a blank page, if you think is the ini file, then show me how to use your ini file then or what suggestion do you have? <form action="FormToEmail.php" method="post"> <table border="1" bgcolor="yellow" cellspacing="5"> <tr><td>Email address</td><td><input type="text" size="30" name="my_email"></td></tr> <tr><td>Name</td><td><input type="text" size="30" name="name"></td></tr> <tr><td>Email address</td><td><input type="text" size="30" name="email"></td></tr> <tr><td valign="top">Comments</td><td><textarea name="comments" rows="6" cols="30"></textarea></td></tr> <tr><td> </td><td><input type="submit" value="Send"></td></tr> </table> </form> <?php $my_email = "myemail"; $errors = array(); if(count($_COOKIE)){foreach(array_keys($_COOKIE) as $value){unset($_REQUEST[$value]);}} 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); if(isset($_REQUEST['email']) && !empty($_REQUEST['email'])) { 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;}}}}}} } 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";} 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); 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");} 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 = stripslashes($message); $subject = "FormToEmail Comments"; $headers = "From: " . $_REQUEST['email']; mail($my_email,$subject,$message,$headers); ?> <html> <head> </head> <body bgcolor="yellow" text="#000000"> <div> <center> <b>Thank you <?php print stripslashes($_REQUEST['name']); ?></b> <br>Your message has been sent </center> </div> </body> </html>
  6. ;;;;;;;;;;;;;;;;;;;;;;;;; ; Paths and Directories ; ;;;;;;;;;;;;;;;;;;;;;;;;; ; UNIX: "/path1:/path2" ;include_path = ".:/php/includes" ; ; Windows: "\path1;\path2" ;include_path = ".;c:\php\includes" Php ini is this, doesn't look like anything is changed.
  7. so what should I do and how could I fixed it? thanks
  8. //include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded echo "Number 2"; I didn't get number 2 after the echo include.
  9. i get Testing in the page
  10. I copied the exact code you just had and made only Changes to myemail and my password and run it in localhost/TEST.php and again is blank. my php ini file is this: I didn't change anything [mail function] ; For Win32 only. SMTP = localhost smtp_port = 25 ;;;;;;;;;;;;;;;;;;;;;;;;; ; Paths and Directories ; ;;;;;;;;;;;;;;;;;;;;;;;;; ; UNIX: "/path1:/path2" ;include_path = ".:/php/includes" ; ; Windows: "\path1;\path2" ;include_path = ".;c:\php\includes"
  11. <?php error_reporting(E_ALL); require_once('class.phpmailer.php'); //require_once('../class.phpmailer.php'); $mail = new PHPMailer(); $body = "testing <b>PHP Mailer</b> wooohooo"; $mail->IsSMTP(); // telling the class to use SMTP $mail->SMTPDebug = 2; // enables SMTP debug information (for testing) // 1 = errors and messages // 2 = messages only $mail->SMTPAuth = true; // enable SMTP authentication $mail->SMTPSecure = "ssl"; // sets the prefix to the servier $mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server $mail->Port = 465; // set the SMTP port for the GMAIL server //update $mail->Username = "testtst797@gmail.com"; // GMAIL username $mail->Password = "abc87645"; // GMAIL password $mail->SetFrom('testtst797@gmail.com', 'First Last'); $mail->Subject = "PHPMailer Test Subject via smtp (Gmail), basic"; $mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test $mail->MsgHTML($body); $address = "whoto@otherdomain.com"; $mail->AddAddress($address, "John Doe"); if(!$mail->Send()) { echo "Mailer Error: " . $mail->ErrorInfo; } else { echo "Message sent!"; } ?>
  12. yup changed that and still same result, blank page, didn't get sent.
  13. hi MadTechie Let me go over what I did, I created a gmail account testtst797@gmail.com, copied your code and adjust a few things as you could see on the bottom. <?php require_once('../class.phpmailer.php'); $mail = new PHPMailer(); $body = "testing <b>PHP Mailer</b> wooohooo"; $mail->IsSMTP(); // telling the class to use SMTP $mail->SMTPDebug = 2; // enables SMTP debug information (for testing) // 1 = errors and messages // 2 = messages only $mail->SMTPAuth = true; // enable SMTP authentication $mail->SMTPSecure = "ssl"; // sets the prefix to the servier $mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server $mail->Port = 465; // set the SMTP port for the GMAIL server //update $mail->Username = "testtst797@gmail.com"; // GMAIL username $mail->Password = "ABC2873"; // GMAIL password $mail->SetFrom('testtst797@gmail.com', 'First Last'); $mail->Subject = "PHPMailer Test Subject via smtp (Gmail), basic"; $mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test $mail->MsgHTML($body); $address = "whoto@otherdomain.com"; $mail->AddAddress($address, "John Doe"); if(!$mail->Send()) { echo "Mailer Error: " . $mail->ErrorInfo; } else { echo "Message sent!"; } ?> copied class.phpmailer and save it in the same directory as I save your code which is TEST.php I then just go to browser and type http://localhost/test.php it shows nothing, blank page all white. mail didn't get sent any suggestions?
  14. I did as you say, with both gmail (i just created a new email) and yahoo (made a few changes on your php file) and save the class.phpmailer php file in the same directory as your php file and it didn't work. It is a blank screen on the test.php browser and nothing is send to my email. any ideas?
  15. I have downloaded the phpmailer and do as it says: save these two files in my same directory as my PHP ini file and change this in php ini After doing all this it still doesn't work. Any ideas? I always get the same error message: Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\Apache\htdocs\FormToEmail.php on line 197
  16. <form action="/cgi/formmail" method = "POST"> if I put the code as my host suggest to use their formmail built in, how can i run other program that gets call with the action = whatever program. their built in program doesn't allow me to do this: I have yet to download phpmailer and follow your method, I will do so soon.
  17. yea I looked at my email and I see it sent from the from. But I would like it to send to not just two but more, customized subject either I set it or user filled it, and I would like to run other php/html application while do so.
  18. I just tested my host formmail built in function: this is what it said to do: when I set up the form and tested it so it send it to my personal email, I noticed that the subject is: WWW Form Submission and there is a limit on two email distribution, I would like more. and what if I want the action to run another php program, then I can't use their formmail built in.
  19. I noticed another difference on mozilla and internet explorer. Seems like mozilla is what my code is. I didn't provide any link to some of the href and for internet explorer, when clicked on these blank links it will send you to home page and mozilla will not send you to anywhere.
  20. I will download phpmailer and give it a try and let you know. Do you know if on a live hosting server, not localhost, would I still need to download phpmailer for it to work and how does the process work compare with local environment? I know my host provide built in form mail but it is limited in it's function from what I've seen. 1 - limited in number of email it can send out 2 - limited in standard subject line etc. and maybe other limitation I may not know of, is why I like to customized my own script and create flexibility.
  21. My creation blink on mozilla but not on internet explorer anyone know why and how I could fix that. My goal is to have it blink on any browser. thanks
  22. MadTechie from what I know is that form to mail in local environment is more complicated than an internet hosting am I right? and if I am, do you know how to get it to work on local environment. if you can, walk me through each step on how to get it to work pls. thanks.
  23. that is for outlook.
  24. smtp.mail.yahoo.co.uk Check the box next to "My outgoing server (SMTP) requires authentication." what box?
×
×
  • 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.