Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/301751-contact-form-code/
Share on other sites

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 by cyberRobot
Added [code][/code] tags
Link to comment
https://forums.phpfreaks.com/topic/301751-contact-form-code/#findComment-1535649
Share on other sites

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";
 
?>

Link to comment
https://forums.phpfreaks.com/topic/301751-contact-form-code/#findComment-1535678
Share on other sites

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>

Link to comment
https://forums.phpfreaks.com/topic/301751-contact-form-code/#findComment-1535679
Share on other sites

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 by Jacques1
Link to comment
https://forums.phpfreaks.com/topic/301751-contact-form-code/#findComment-1535719
Share on other sites

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 why

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.
Link to comment
https://forums.phpfreaks.com/topic/301751-contact-form-code/#findComment-1535720
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/301751-contact-form-code/#findComment-1535722
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/301751-contact-form-code/#findComment-1535723
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.