> send emails using php ~ Online tutorial

send emails using php

Registration form

We are create registration form which is important in data storing when the entered value in field the data are redirect value to corresponds method by using form tag.Now they store data in Mysql database for furthur processing on the data.

<html>
<body>
<div align='left'>
<table border='1'>

<form name='form1' action='post' method='reglog.php'>
//In which the HTML values will be redirected to reglog.php program using POST method is used


<table bgcolor='skyblue' border='1'>
<tr><td width='50'>Name:</td><td width='50'><input type='name' name='name' placeholder='Enter the Name'>
</td></tr>
<tr><td width='50'>Password:</td><td width='50'><input type='password' name='pass' placeholder='Enter the password'>
</td></tr>
<tr><td width='50'>Retype password:</td><td width='50'><input type='password' name='pass' placeholder='Retype Password'>
</td></tr>
<tr><td width='50'>Email id:</td><td width='50'><input type='text' name='email' placeholder='Enter the Email id'>
</td></tr>
<tr><td width='50'></td><td width='70'><input type='submit' value='Submit'>
</td></tr>
<tr>
</form>
</tr>
</table>
</div>
</body>
</html>


Mysql connectivity

Now we are going to create the database for storing data in verification process .using following MYSQL syntax to create database in MYSQL

Common Syntax
Create database
create database database_name;
Use database
use database_name;
create table query
create table tab_name(tab_name varchar(20),tab_name1 varchar(20),tab_name3 varchar(20),tab_name4 varchar(20),));


Sending mail in php:

Now we are create database connectivity for the program

<?php
$tbl_name=name of table;
// Random confirmation code
$confirm_code=md5(uniqid(rand()));
// values sent from form
mysql_select_db($db_name);
$name=$_POST['name'];
$pass=$_POST['pass'];
$repass=$_POST['repass'];
$email=$_POST['email'];
$insert=mysql_query("insert into table_name(name,pass,repass,email)values('$name','$pass','$repass','$email')");
if($result)
{
$to=$email;
$subject="Your confirmation link here";
$header="from: your name ";
$message="Your Comfirmation link \r\n";
$message.="Click on this link to activate your account \r\n";
$message.="http://www.yousiteaddress.com/confirmation.php?passkey=$confirm_code";
$sentmail = mail($to,$subject,$message,$header);
}
else
{
echo "Not found your email in our database";
}
if($sentmail)
{
echo "Your Confirmation link Has Been Sent To Your Email Address.";
}
else {
echo "Cannot send Confirmation link to your e-mail address";
}
?>

Please Give Us Your 1 Minute In Sharing This Post!
Please Give Us Your 1 Minute In Sharing This Post!
SOCIALIZE IT →
FOLLOW US →
SHARE IT →
Powered By: BloggerYard.Com

0 comments: