Jump to content

PHP SMTP using Gmail SMTP


m@m

Recommended Posts

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]

Link to comment
https://forums.phpfreaks.com/topic/246418-php-smtp-using-gmail-smtp/
Share on other sites

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>

 

 

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)

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);
	}
?>

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);
	}
?>

Archived

This topic is now archived and is closed to further replies.

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