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 example@gmail.com 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(example@gmail.com )

 

Thanks

 

 

 

[attachment deleted by admin]

Link to comment
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>

 

 

Link to comment
Share on other sites

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: XXXX@XXXXX.com";


		$subject = "Your SUBJECT";//
		$message = "MESSAGE";  
		 mail($to, $subject, $message, $headers);
	}
?>

Link to comment
Share on other sites

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: XXXX@XXXXX.com";


		$subject = "Your SUBJECT";//
		$final_message = "MESSAGE ---- <br/>
						 name -- $name <br/>
						 email -- $email<br/>
						 message -- $message<br/> ";  
		 mail($to, $subject, $final_message, $headers);
	}
?>

Link to comment
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.