m@m Posted September 4, 2011 Share Posted September 4, 2011 Here i have attached PHP contact form.Anyone filled this form and then need to go email to the admin . as example admin uses [email protected] as his email address... how can i do this ? in simply when i filledout this form and click Submit button then that information need to go admins email address([email protected] ) Thanks [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/246418-php-smtp-using-gmail-smtp/ Share on other sites More sharing options...
voip03 Posted September 4, 2011 Share Posted September 4, 2011 please post the code using code tag. Quote Link to comment https://forums.phpfreaks.com/topic/246418-php-smtp-using-gmail-smtp/#findComment-1265378 Share on other sites More sharing options...
m@m Posted September 4, 2011 Author Share Posted September 4, 2011 index.php file ------------------- <?php include_once("recaptchalib.php"); define("PUB_KEY", "6LfUuMcSAAAAAAY3ykPm2KZ2cHnSyoSRDaG1zTZi"); ?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Request Form</title> <style type='text/css'> body { font-size: 14px; line-height:1.3em; text-align:center; } #wrapper { width:600px; margin:0 auto; text-align:left; padding:6px; } .message { text-align:left; width:100%; padding:15px 22px; display:none; } .loader { background:url("images/ajax-loader.gif") no-repeat center left; } .success { background:url("images/success.png") no-repeat center left; } .error { background:url("images/error.png") no-repeat center left; } .infoWrapper { clear:both; margin-top:10px; } .infoTitle { color:#808080; float:left; width:110px; text-align:right; } .infoContent { padding-left:130px; text-align: left; } label { cursor:pointer; } .input-text { border:1px solid #808080; } .long { width:450px; } .tall { height:150px; } </style> <script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js'></script> <script type="text/javascript" src="functions.js"></script> </head> <body> <div id='wrapper'> <h4>Blog Account Request Form</h4> <div class='message'> </div> <form name='contact' id='contact'> <div class="infoWrapper"> <div class="infoTitle"> <label for='name'>Name</label> </div> <div class="infoContent"> <input type="text" name='name' id='title' class='input-text long' /> </div> </div> <div class="infoWrapper"> <div class="infoTitle"> <label for='email'>Email</label> </div> <div class="infoContent"> <input type="text" name='email' id='title' class='input-text long' /> </div> </div> <div class="infoWrapper"> <div class="infoTitle"> <label for="message">Message</label> </div> <div class="infoContent"> <textarea name='message' id='note' class='input-text long tall'></textarea> </div> </div> <div class="infoWrapper"> <div class="infoTitle"> <label for="">Are you human?</label> </div> <div class="infoContent"> <?php echo recaptcha_get_html(PUB_KEY); ?> </div> </div> <div class="infoWrapper"> <div class="infoTitle"></div> <div class="infoContent"> <input type='submit' value='Send Message'/> </div> </div> </form> </div> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/246418-php-smtp-using-gmail-smtp/#findComment-1265381 Share on other sites More sharing options...
voip03 Posted September 4, 2011 Share Posted September 4, 2011 What is the problem? Quote Link to comment https://forums.phpfreaks.com/topic/246418-php-smtp-using-gmail-smtp/#findComment-1265383 Share on other sites More sharing options...
m@m Posted September 4, 2011 Author Share Posted September 4, 2011 In here theres a 3 fileds.. 1.Name 2.Email 3.Message I need when someone fill this form and click submit button then that all the data go to [email protected] address... need php coding for that exact form here ( http://sliit2011.net46.net/doctorsblog/blogrequest/index.php) Quote Link to comment https://forums.phpfreaks.com/topic/246418-php-smtp-using-gmail-smtp/#findComment-1265386 Share on other sites More sharing options...
voip03 Posted September 4, 2011 Share Posted September 4, 2011 You need mail() function if you goohle it php mail() tutorials. http://php.net/manual/en/function.mail.php Quote Link to comment https://forums.phpfreaks.com/topic/246418-php-smtp-using-gmail-smtp/#findComment-1265391 Share on other sites More sharing options...
m@m Posted September 4, 2011 Author Share Posted September 4, 2011 I google it ..but i'm fresher to php If you can please do it for me thanks Quote Link to comment https://forums.phpfreaks.com/topic/246418-php-smtp-using-gmail-smtp/#findComment-1265392 Share on other sites More sharing options...
voip03 Posted September 4, 2011 Share Posted September 4, 2011 Sart writing the code, I will help you. follow this link. http://www.kirupa.com/forum/showthread.php?17313-HTML-PHP-mail-Form-Tutorial Quote Link to comment https://forums.phpfreaks.com/topic/246418-php-smtp-using-gmail-smtp/#findComment-1265395 Share on other sites More sharing options...
m@m Posted September 4, 2011 Author Share Posted September 4, 2011 i read that but i don't now hoe to apply this to my form Quote Link to comment https://forums.phpfreaks.com/topic/246418-php-smtp-using-gmail-smtp/#findComment-1265398 Share on other sites More sharing options...
voip03 Posted September 4, 2011 Share Posted September 4, 2011 Come on, I am sure you can do it. Follow these steps 1. on submit 2. send this message <?PHP if($_POST['submit']) { $headers = "MIME-Version: 1.0\r\n"; $headers.= "Content-type: text/html; charset=iso-8859-1\r\n"; $headers.= "From: XXXXX\r\nReply-To: [email protected]"; $subject = "Your SUBJECT";// $message = "MESSAGE"; mail($to, $subject, $message, $headers); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/246418-php-smtp-using-gmail-smtp/#findComment-1265411 Share on other sites More sharing options...
m@m Posted September 4, 2011 Author Share Posted September 4, 2011 in here subjects,from/to email addresses hardcode know? only go from specific address know? Quote Link to comment https://forums.phpfreaks.com/topic/246418-php-smtp-using-gmail-smtp/#findComment-1265414 Share on other sites More sharing options...
voip03 Posted September 4, 2011 Share Posted September 4, 2011 your code <input type='submit' value='Send Message'/> change to <input type='submit' name='submit' value='Send Message'/> your code <?php include_once("recaptchalib.php"); define("PUB_KEY", "6LfUuMcSAAAAAAY3ykPm2KZ2cHnSyoSRDaG1zTZi"); change to <?php include_once("recaptchalib.php"); define("PUB_KEY", "6LfUuMcSAAAAAAY3ykPm2KZ2cHnSyoSRDaG1zTZi"); if($_POST['submit']) { $name = $_POST['name']; $email= $_POST['email']; $message= $_POST['message']; $headers = "MIME-Version: 1.0\r\n"; $headers.= "Content-type: text/html; charset=iso-8859-1\r\n"; $headers.= "From: XXXXX\r\nReply-To: [email protected]"; $subject = "Your SUBJECT";// $final_message = "MESSAGE ---- <br/> name -- $name <br/> email -- $email<br/> message -- $message<br/> "; mail($to, $subject, $final_message, $headers); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/246418-php-smtp-using-gmail-smtp/#findComment-1265420 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.