aubreymendez Posted August 4, 2016 Share Posted August 4, 2016 The file bob.html has a 4 field contact form......Name.......email id.......phone and message. I need the rdstest.php file to be coded so that whenever the 4 fields contact form is filled up by a customer all the details should reach me at aubrey@bkengineering.in as an email. bob.html class.phpmailer.php class.smtp.php rdstest.php Quote Link to comment https://forums.phpfreaks.com/topic/301751-contact-form-code/ Share on other sites More sharing options...
lovephp Posted August 4, 2016 Share Posted August 4, 2016 Post the codes don't go uploading files in bulk. And what have you tried so far? Quote Link to comment https://forums.phpfreaks.com/topic/301751-contact-form-code/#findComment-1535572 Share on other sites More sharing options...
ginerjm Posted August 4, 2016 Share Posted August 4, 2016 Yes - please post the RELEVANT code so that we can help you. What have you tried to do so far? Mail? Quote Link to comment https://forums.phpfreaks.com/topic/301751-contact-form-code/#findComment-1535590 Share on other sites More sharing options...
aubreymendez Posted August 5, 2016 Author Share Posted August 5, 2016 (edited) Hi guys thanks for the reply..... the contact form code is..... <form name="htmlform" method="post" action=""> <table width="450px"> <tr> <td valign="top"> <label for="first_name">Name *</label> </td> <td valign="top"> <input type="text" name="first_name" maxlength="50" size="30"/> </td> </tr> <tr> <td valign="top"> <label for="email">Email Address *</label> </td> <td valign="top"> <input type="text" name="email" maxlength="50" size="30"/> </td> </tr> <tr> <td valign="top"> <label for="telephone">Telephone Number</label> </td> <td valign="top"> <input type="text" name="telephone" maxlength="50" size="30"/> </td> </tr> <tr> <td valign="top"> <label for="comments"> Your message *</label> </td> <td valign="top"> <textarea name="comments" maxlength="1000" cols="35" rows="6"></textarea> </td> </tr> <tr> <td colspan="2" style="text-align:center"> <input type="submit" value="Submit"/> </td> </tr> </table> </form> and the php file is....... <?php $smtp_host = "mail.your domain.com"; $smtp_user = "xxxx@yourdomain.com"; $smtp_password = "xxxxxxxxxxxx"; $smtp_port = "25"; /*$smtp_ssl = "False";*/ /*$smtp_ssl = "True";*/ $mail_from = "xxxx@yourdomain.com"; $mail_from_name = "RDS Support"; $mail_to = "xxx@gmail.com"; $mail_to_name = "RDS Support"; ?> <html> <head> <title>PHPMailer - SMTP basic test with authentication</title> </head> <body> <?php //error_reporting(E_ALL); error_reporting(E_STRICT); date_default_timezone_set('Asia/Kolkata'); require_once('class.phpmailer.php'); // include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded $mail = new PHPMailer(); //$body = file_get_contents('contents.html'); //$body = preg_replace('/[\]/','',$body); $body = 'Test'; echo $body; echo "---"; $mail->IsSMTP(); // telling the class to use SMTP $mail->Host = "{$smtp_host}"; // SMTP server $mail->SMTPDebug = 2; // enables SMTP debug information (for testing) // 1 = errors and messages // 2 = messages only $mail->SMTPAuth = true; // enable SMTP authentication $mail->Host = "{$smtp_host}"; // sets the SMTP server $mail->Port = $smtp_port; // set the SMTP port for the GMAIL server $mail->Username = "{$smtp_user}"; // SMTP account username $mail->Password = "{$smtp_password}"; // SMTP account password $mail->SetFrom("{$mail_from}", "{$mail_from_name}"); $mail->AddReplyTo("{$mail_from}", "{$mail_from_name}"); $mail->Subject = "PHPMailer Test Subject via smtp, basic with authentication"; $mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test $mail->MsgHTML($body); $address = "{$mail_to}"; $mail->AddAddress($address, "{$mail_to_name}" ); //$mail->AddAttachment("images/phpmailer.gif"); // attachment //$mail->AddAttachment("images/phpmailer_mini.gif"); // attachment if(!$mail->Send()) { echo "Mailer Error: " . $mail->ErrorInfo; } else { echo "Message sent!"; } ?> </body> </html> Edited August 5, 2016 by cyberRobot Added [code][/code] tags Quote Link to comment https://forums.phpfreaks.com/topic/301751-contact-form-code/#findComment-1535649 Share on other sites More sharing options...
Jacques1 Posted August 5, 2016 Share Posted August 5, 2016 So, what's the problem? Or is everything fine now? Quote Link to comment https://forums.phpfreaks.com/topic/301751-contact-form-code/#findComment-1535652 Share on other sites More sharing options...
cyberRobot Posted August 5, 2016 Share Posted August 5, 2016 If you are asking how to get the information from the form, you would use $_POST. More information can be found here: http://php.net/manual/en/reserved.variables.post.php Quote Link to comment https://forums.phpfreaks.com/topic/301751-contact-form-code/#findComment-1535672 Share on other sites More sharing options...
aubreymendez Posted August 5, 2016 Author Share Posted August 5, 2016 this part is what i need to be changed.....I dont know php so pls do the needful....thanks..... <?php$smtp_host = "mail.your domain.com";$smtp_user = "xxxx@yourdomain.com";$smtp_password = "xxxxxxxxxxxx";$smtp_port = "25";/*$smtp_ssl = "False";*//*$smtp_ssl = "True";*/ $mail_from = "xxxx@yourdomain.com";$mail_from_name = "RDS Support"; $mail_to = "xxx@gmail.com";$mail_to_name = "RDS Support"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/301751-contact-form-code/#findComment-1535678 Share on other sites More sharing options...
aubreymendez Posted August 5, 2016 Author Share Posted August 5, 2016 the fields need to be changed here,.......but i dont know how..... <?php$smtp_host = "mail.your domain.com";$smtp_user = "xxxx@yourdomain.com";$smtp_password = "xxxxxxxxxxxx";$smtp_port = "25";/*$smtp_ssl = "False";*//*$smtp_ssl = "True";*/ $mail_from = "xxxx@yourdomain.com";$mail_from_name = "RDS Support"; $mail_to = "xxx@gmail.com";$mail_to_name = "RDS Support"; ?><html><head><title>PHPMailer - SMTP basic test with authentication</title></head><body> <?php //error_reporting(E_ALL);error_reporting(E_STRICT); date_default_timezone_set('Asia/Kolkata'); require_once('class.phpmailer.php');// include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded $mail = new PHPMailer(); //$body = file_get_contents('contents.html');//$body = preg_replace('/[\]/','',$body);$body = 'Test';echo $body;echo "---"; $mail->IsSMTP(); // telling the class to use SMTP$mail->Host = "{$smtp_host}"; // SMTP server$mail->SMTPDebug = 2; // enables SMTP debug information (for testing) // 1 = errors and messages // 2 = messages only$mail->SMTPAuth = true; // enable SMTP authentication$mail->Host = "{$smtp_host}"; // sets the SMTP server$mail->Port = $smtp_port; // set the SMTP port for the GMAIL server$mail->Username = "{$smtp_user}"; // SMTP account username$mail->Password = "{$smtp_password}"; // SMTP account password $mail->SetFrom("{$mail_from}", "{$mail_from_name}"); $mail->AddReplyTo("{$mail_from}", "{$mail_from_name}"); $mail->Subject = "PHPMailer Test Subject via smtp, basic with authentication"; $mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test $mail->MsgHTML($body); $address = "{$mail_to}";$mail->AddAddress($address, "{$mail_to_name}" ); //$mail->AddAttachment("images/phpmailer.gif"); // attachment//$mail->AddAttachment("images/phpmailer_mini.gif"); // attachment if(!$mail->Send()) { echo "Mailer Error: " . $mail->ErrorInfo;} else { echo "Message sent!";} ?> </body></html> Quote Link to comment https://forums.phpfreaks.com/topic/301751-contact-form-code/#findComment-1535679 Share on other sites More sharing options...
Jacques1 Posted August 5, 2016 Share Posted August 5, 2016 So you're freelancing as a web designer, but you have no idea what you're doing and now want us to help you out for free? Quote Link to comment https://forums.phpfreaks.com/topic/301751-contact-form-code/#findComment-1535680 Share on other sites More sharing options...
aubreymendez Posted August 6, 2016 Author Share Posted August 6, 2016 all the sites i design are in html....never worked on php..... Quote Link to comment https://forums.phpfreaks.com/topic/301751-contact-form-code/#findComment-1535708 Share on other sites More sharing options...
Jacques1 Posted August 6, 2016 Share Posted August 6, 2016 Then either learn it, or stop telling your customers that you can create dynamic websites for them. Quote Link to comment https://forums.phpfreaks.com/topic/301751-contact-form-code/#findComment-1535712 Share on other sites More sharing options...
benanamen Posted August 6, 2016 Share Posted August 6, 2016 @lovephp, No, No, and NO! Quote Link to comment https://forums.phpfreaks.com/topic/301751-contact-form-code/#findComment-1535714 Share on other sites More sharing options...
lovephp Posted August 6, 2016 Share Posted August 6, 2016 Hehe why Quote Link to comment https://forums.phpfreaks.com/topic/301751-contact-form-code/#findComment-1535715 Share on other sites More sharing options...
benanamen Posted August 6, 2016 Share Posted August 6, 2016 It's a waste of time to even get into it. It is VERY bad code. Toss it and don't ever post it again. You might as well ask everyone to hack you. And that's just for starters. Quote Link to comment https://forums.phpfreaks.com/topic/301751-contact-form-code/#findComment-1535716 Share on other sites More sharing options...
lovephp Posted August 6, 2016 Share Posted August 6, 2016 Ah yes i just copy pasted to make it simpler for him to understand. Not my code Quote Link to comment https://forums.phpfreaks.com/topic/301751-contact-form-code/#findComment-1535718 Share on other sites More sharing options...
Jacques1 Posted August 6, 2016 Share Posted August 6, 2016 (edited) This isn't funny. We're talking about a business website here. Your code will turn the server into an open mail relay which can be used by anybody to send spam and malware to arbitrary addresses, and the OP clearly doesn't have the competence to recognize that. If the code is actually uploaded, quite a lot of people are in deep trouble: the victims of the spam/malware the business which is seemingly responsible for sending those e-mails the OP, because he's the one who uploaded the script we, because it's coming from this forum you, because you've suggested it It's great that you want to help, but do it responsibly. Don't just post code you found somewhere on the Internet when you have no idea what it does. This may cause actual harm. For now, I've deactivated your post. If you want to continue the discussion, a moderator can move your posts into a new thread. Edited August 6, 2016 by Jacques1 Quote Link to comment https://forums.phpfreaks.com/topic/301751-contact-form-code/#findComment-1535719 Share on other sites More sharing options...
ginerjm Posted August 6, 2016 Share Posted August 6, 2016 Jacques1 - Well said! LovePHP - If you want to help someone in the future, and want to post code, how about posting YOUR code, code that YOU know and can support and not some random script you found. The OP could have easily done that so why do you think that you needed to do that very same thing? We're here to help people with their code and not to be research automatons. Your brief response in #13 Hehe whyshows that you aren't up to this task. We take this seriously. If you wish to remain on this site and wish to be of help, responses such as #13 will not do much to improve your reputation. Quote Link to comment https://forums.phpfreaks.com/topic/301751-contact-form-code/#findComment-1535720 Share on other sites More sharing options...
lovephp Posted August 6, 2016 Share Posted August 6, 2016 Ok apologies guys will not repeat this again Quote Link to comment https://forums.phpfreaks.com/topic/301751-contact-form-code/#findComment-1535721 Share on other sites More sharing options...
lovephp Posted August 6, 2016 Share Posted August 6, 2016 This isn't funny. We're talking about a business website here. Your code will turn the server into an open mail relay which can be used by anybody to send spam and malware to arbitrary addresses, and the OP clearly doesn't have the competence to recognize that. If the code is actually uploaded, quite a lot of people are in deep trouble: the victims of the spam/malware the business which is seemingly responsible for sending those e-mails the OP, because he's the one who uploaded the script we, because it's coming from this forum you, because you've suggested it It's great that you want to help, but do it responsibly. Don't just post code you found somewhere on the Internet when you have no idea what it does. This may cause actual harm. For now, I've deactivated your post. If you want to continue the discussion, a moderator can move your posts into a new thread. No no its ok delete that post and sorry about it, you all are right i made a mistake i accept it Quote Link to comment https://forums.phpfreaks.com/topic/301751-contact-form-code/#findComment-1535722 Share on other sites More sharing options...
lovephp Posted August 6, 2016 Share Posted August 6, 2016 Jacques1 - Well said! LovePHP - If you want to help someone in the future, and want to post code, how about posting YOUR code, code that YOU know and can support and not some random script you found. The OP could have easily done that so why do you think that you needed to do that very same thing? We're here to help people with their code and not to be research automatons. Your brief response in #13 shows that you aren't up to this task. We take this seriously. If you wish to remain on this site and wish to be of help, responses such as #13 will not do much to improve your reputation. Accept it sorry about it Quote Link to comment https://forums.phpfreaks.com/topic/301751-contact-form-code/#findComment-1535723 Share on other sites More sharing options...
benanamen Posted August 6, 2016 Share Posted August 6, 2016 For now, I've deactivated your post. Rightfully so. Quote Link to comment https://forums.phpfreaks.com/topic/301751-contact-form-code/#findComment-1535726 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.