Loading...
Menu

Gmail tutorials

Email tutorial

Thanks for downloading this video sharing tutorial eBook.

You are free to distribute this eBook with your friends and colleagues. We have many tutorials like; how to create a social network tutorial like Facebook in php and JavaScript,

Ho to create twitter tutorial in php and JavaScript,

Ho to create Gmail tutorial in php and JavaScript,

Ho to create twitter web plug-in like who is online.

Visit our website to follow and download all this tutorials for free at www.23tutorials.com

Gmail tutorial

Index.css………………………………………………………..4

Home.css…………………………………………………………………………..8

Connection.php…………………………………………………25

Function.php……………………………………………………26

Registration script………………………………………………27

Login script………………………………………………36

Show user profile name / photo script…………………41

How to search emails script…………………………….44

How to compose email script……………………………48

How to view inbox email script…………………………53

How to view full email script…………………………….57

How to reply email script………………………………..67

How to download email file script……………………….70

How to delete email script ………………………………77

How to draft email script…………………………………82

How to view draft email script…………………………..87

How to view outbox email script…………………………91

How edit account script…………………………………..95

Index.css

This css is for styling the index.php page.

body{

margin-left:-0%;

margin-top:0%;

margin-right:-0%;

background-color:#dddddd;

}

#index_page_header{

position:fixed;

background-color:blue;

width:1280px;

height:80px;

top:-21px;

left:0px;

z-index: 2;

}

#registration_div{

background-color:;

width:304px;

height:420px;

position:absolute;

top:95px;

font-weight:bold;

left:7px;

border:1px solid white;

border-radius:5px;

}

h1{

color:white;

}

h2{

position:absolute;

color:green;

font-size:17px;

left:40px;

top:-12px;

}

.reg{

position:relative;

left:3px;

border-radius:4px;

border:0px;

height:30px;

width:295px;

}

#submit_bitton{

position:relative;

background-color:blue;

left:80px;

top:-35px;

border-radius:4px;

border:0px;

height:30px;

width:125px;

color:white;

}

#login_div{

background-color:;

position:absolute;

top:0px;

margin-left:327px;

width:200px;

border:0px solid white;

}

#login_email{

position:relative;

left:3px;

border-radius:0px;

border:0px;

height:25px;

width:298px;

}

#login_password{

position:relative;

top:2px;

left:3px;

border-radius:0px;

border:0px;

height:25px;

width:298px;

}

#login_button{

position:absolute;

background-color:blue;

left:0px;

top:60px;

border-radius:0px;

border:1px solid grey;

height:23px;

width:55px;

color:white;

}

Home.css

This home.css page is used to style the home.php page.

/* div containing profile picture */

.profile-photo{

position:absolute;

top:84px;

left:10px;

width:150px;

height:140px;

background-color:white;

border:1px solid #cce;

border-radius:6px;

}

/* profile name */

#profile_name{

position:relative;

top:-27px;

left:2px;

font-size:17px;

}

/* profile picture */

.profile_pic{

position:absolute;

top:4px;

left:4px;

width:142px;

height:132px;

border-radius:6px;

}

/* div for uploading videos */

.upload-video-div{

position:absolute;

top:84px;

left:210px;

width:440px;

height:140px;

background-color:white;

border:1px solid #ccc;

border-radius:6px;

}

/* div for syling uploading forms like youtube */

.fileUpload {

position: relative;

overflow: hidden;

margin: 10px;

background-color:white;

height: 123px;

width: 180px;

text-align: center;

top:-2px;

border:1px solid black;

}

.fileUpload input.upload {

position: absolute;

top: 0;

right: 0;

margin: 0;

padding: 0;

font-size: 20px;

cursor: pointer;

opacity: 0;

filter: alpha(opacity=0);

height: 100%;

text-align: center;

}

.custom-span{ font-family: Arial; font-weight: bold;font-size: 100px; color: #FE57A1}

#uploadFile{border: none;margin-left: 10px; width: 200px;}

.custom-para{font-family: arial;font-weight: bold;font-size: 24px; color:#585858;}

#photo_text{

position:absolute;

width:350px;

height:36px;

left:147px;

top:75px;

font-size:16px;

}

#photo_comment{

position:absolute;

left:150px;

top:30px;

font-size:20px;

}

#submit_photo{

position:absolute;

width:340px;

height:50px;

left:155px;

top:120px;

font-size:24px;

background-color:white;

border:0px solid black;

color:white;

}

.preview

{

position:absolute;

left:185px;

top:-52px;

border:0px solid black;

}

#preview

{

position:absolute;

top:60px;

color:#cc0000;

font-size:12px

}

/* end of div for syling uploading forms like youtube */

.left-bar-links{

position:absolute;

width:160px;

height:120px;

left:10px;

top:240px;

font-size:17px;

background-color:#dddddd;

border:0px solid #ccc;

color:black;

}

.left-bar-links a {

text-decoration:none;

color:black;

}

#noticeboard{

width:780px;

height:35px;

border:0px solid #cce;

background-color:;

position:absolute;

left:20px;

top:0px;

}

.content{

width:380px;

margin:0 auto;

position:absolute;

top:37px;

left:190px;

}

#searchid

{

position:absolute;

width:480px;

border:1px solid #cce;

padding:10px;

font-size:14px;

border-radius:5px;

}

#result

{

position:absolute;

width:480px;

padding:10px;

display:none;

top:37px;

border-top:1px;

overflow:hidden;

border:1px #CCC solid;

background-color:#cce;

}

.compose-message-header{

position:absolute;

background-color:white;

-webkit-box-shadow: 0 3px 8px rgba(0, 0, 0, .25);

overflow: visible;

top:84px;

margin-left:210px;

width:500px;

border-radius:3px;

border:;

padding:1px;

height:30px;

}

.compose-message-header-text{

position:relative;

left:10px;

top:-21px;

font-size:15px;

}

.receiver_email_form{

position:absolute;

background-color:white;

-webkit-box-shadow: 0 3px 8px rgba(0, 0, 0, .25);

overflow: visible;

top:126px;

margin-left:210px;

width:500px;

border-radius:3px;

border:1px solid #cce;

padding:1px;

height:33px;

line-height: 1.42857143;

-webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, .6);

box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, .6);

}

.message_subject{

position:absolute;

background-color:white;

-webkit-box-shadow: 0 3px 8px rgba(0, 0, 0, .25);

overflow: visible;

top:172px;

margin-left:210px;

width:500px;

border-radius:3px;

border:1px solid #cce;

padding:1px;

height:33px;

line-height: 1.42857143;

-webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, .6);

box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, .6);

}

.message-div{

position:absolute;

background-color:white;

-webkit-box-shadow: 0 3px 8px rgba(0, 0, 0, .25);

overflow: visible;

top:219px;

margin-left:210px;

width:500px;

border-radius:3px;

border:1px solid #cce;

padding:1px;

height:233px;

line-height: 1.42857143;

-webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, .6);

box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, .6);

}

.message-body-container{

position:relative;

background-color:white;

color:black;

overflow: visible;

width:500px;

border-radius:1px;

border:0px solid #cce;

padding:1px;

height:233px;

}

.upload_file{

position:absolute;

top:459px;

margin-left:210px;

background-color:white;

}

.submit-button{

background-color:blue;

position:absolute;

top:490px;

margin-left:210px;

width:90px;

height:40px;

border:1px solid #ccc;

border-radius:5px;

color:white;

}

.inbox-message-div{

background-color:white;

border: 2px solid #ccc;

-webkit-box-shadow: 0 3px 8px rgba(0, 0, 0, .25);

overflow: visible;

position: relative;

top:123px;

margin-left:210px;

width:500px;

border-radius:3px;

font-size:13px;

-webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, .6);

box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, .6);

}

.sender-email{

position:absolute;

top:-13px;

margin-left:10px;

font-size:14px;

text-decoration:underline;

}

.draft_email{

position:absolute;

top:3px;

margin-left:423px;

font-size:13px;

text-decoration:none;

}

.delete_email{

position:absolute;

top:42px;

margin-left:423px;

font-size:13px;

text-decoration:none;

}

.email-subject{

position:absolute;

top:9px;

margin-left:20px;

font-size:14px;

text-decoration:none;

}

.email-file{

position:absolute;

top:21px;

margin-left:423px;

font-size:14px;

text-decoration:none;

}

.download-file{

position:absolute;

top:11px;

margin-left:385px;

font-size:12px;

text-decoration:none;

}

.email_date{

position:absolute;

top:-10px;

margin-left:425px;

font-size:11px;

text-decoration:underline;

}

.email_text{

border:0px solid #ccc;

position:relative;

top:30px;

margin-left:29px;

color:grey;

border-radius:0px;

font-size:16px;

padding-bottom:23px;

}

.inbox-message-div a{

text-decoration:none;

color:grey;

}

.reply-message-div{

position:absolute;

background-color:white;

-webkit-box-shadow: 0 3px 8px rgba(0, 0, 0, .25);

overflow: visible;

top:235px;

margin-left:210px;

width:500px;

border-radius:3px;

border:1px solid #cce;

padding:1px;

height:153px;

line-height: 1.42857143;

-webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, .6);

box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, .6);

}

.reply-message-body-container{

position:absolute;

background-color:white;

color:black;

width:498px;

border-radius:0px;

border:0px solid #cce;

padding:0px;

height:151px;

top:2px;

left:2px;

padding:1px;

font-family: “lucida grande”,tahoma,verdana,arial,sans-serif;

}

.reply-submit-button{

background-color:blue;

position:absolute;

top:400px;

margin-left:210px;

width:90px;

height:40px;

border:1px solid #ccc;

border-radius:5px;

color:white; }

.reply-email-text{

position:absolute;

top:206px;

margin-left:212px;

font-size:12px;

}

/* styling the edit info page */

.edit-info-div{

position:absolute;

background-color:white;

-webkit-box-shadow: 0 3px 8px rgba(0, 0, 0, .25);

overflow: visible;

top:124px;

margin-left:210px;

width:500px;

border-radius:3px;

border:;

padding:1px;

height:270px;

}

.edit_account_form

{

width:300px;

height:30px;

}

#submit_button

{

position:relative;

width:120px;

height:50px;

left:104px;

top:-9px;

border-radius:5px;

border:1px solid #cce;

background-color:#f4f8fb;

color:blue;

font-size:29px;

}

#position_edit_form{

position:relative;

left:24px;

top:39px;

 

 

 

 

connection.php

This php file connects this tutorial to the database.

$mysql_hostname= "localhost";
$mysql_user = "root";
$mysql_password = "";
$mysql_database = "learn"; //database name, you can change to yours
$prefix = "";
$bd = mysql_connect($mysql_hostname, $mysql_user, $mysql_password) or die("Could not connect database");
mysql_select_db($mysql_database, $bd) or die("Could not select database");
?>

 

function.php

This php file stores the login user session.

 

include("connection.php");
if(isset($_SESSION["SESS_MEMBER_ID" ] ) ) {
$result = mysql_query("SELECT member_id FROM `member` WHERE `member_id`='".$_SESSION["SESS_MEMBER_ID"]." ' LIMIT 1");
if(mysql_num_rows($result)) {
$row = mysql_fetch_array($result);
$_SESSION["logged"] = $row["member_id"];
}
}
?>

Registration script

This is the registration form where user can sign up to have an email account.

 

Below is the database where all the user information will be kept.

 

CREATE TABLE IF NOT EXISTS `member` (
`member_id`int(11) NOT NULL AUTO_INCREMENT,
`firstname` varchar(30) NOT NULL,
`secondname` varchar(30) NOT NULL,
`email` varchar(30) NOT NULL,
`sex` varchar(100) NOT NULL,
`password` varchar(30) NOT NULL,
`profile_picture` varchar(30) NOT NULL,
`day` varchar(100) NOT NULL,
`month` varchar(30) NOT NULL,
`year` varchar(100) NOT NULL,
PRIMARY KEY (`member_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;

 

Next create a page called index.php which will contain the registration page.

 

Below is the index.php

 

Register to upload your videos













Male

Female

Born on

Day

Month

Year

Next is the php file call “check.php” php file used to live search if email exists already? The Jquery script for the email live search is above is above.

<?php
include(‘connection.php’);
$var= $_POST[‘email’];

$email = ‘@gmail.com’;

$femail = “”;

$smail= “$femail”;

if(strpos($var, ‘@’))

{ echo"

Please don't add @ in your email. It is not accepted.

Input only the names which will be used for your email.

“;

}else
{
echo”

Your prospect email is $smail

“;

$query = mysql_query(“SELECT * FROM member WHERE email=’$femail’”);

if(mysql_num_rows($query) > 0)

{
echo”

This $smail email already exist.

“;

}else
{
echo”

This $smail email has not be taken.

“;

}
}
?>

 

Next is the php file call “exec.php” which insert the registered user information into the database.

<?php

//below variables are being assign to names of input fields in the registration form.

session_start();

include(‘connection.php’);

$firstname=$_POST[‘firstname’];

$secondname=$_POST[‘secondname’];

$email=$_POST[‘email’];

$sex=$_POST[‘sex’];

$password=$_POST[‘password’];

$photo=$_POST[‘profile_picture’];

$day=$_POST[‘day’];

$month=$_POST[‘month’];

$year=$_POST[‘year’];

$fmail = “”;

$smail= “$fmail”;

if(strpos($email, ‘@’))

{

//if the user email contains @ it will rejects the email. The user should enter only usernames which will be converted into an email echo"

Please don't add @ in your email. It is not accepted.

Input only the names which will be used for your email.

“;

}else

{

echo”

Your prospect email is

“;

$query = mysql_query(“SELECT * FROM member WHERE email=’$smail’”);

if(mysql_num_rows($query) > 0)

{

echo”

This email already exist.

“;

}else

{

//Below insert the registered user information into the database when it has passed the above validation.

mysql_query(“INSERT INTO member(firstname, secondname, email, sex, password, profile_picture, day, month, year)

VALUES”);

header(“location:home.php”);

mysql_close($con);

//Create query

$qry=“SELECT * FROM member WHERE email=’$smail’ AND password=’$password’”;

$result=mysql_query($qry);

//Check whether the query was successful or not.

if($result)

{

if(mysql_num_rows($result) > 0)

{

//register Successful

session_regenerate_id();

$member = mysql_fetch_assoc($result);

$_SESSION[‘SESS_MEMBER_ID’] = $member[‘member_id’];

$_SESSION[‘SESS_FIRST_NAME’] = $member[‘email’];

$_SESSION[‘SESS_LAST_NAME’] = $member[‘password’];

session_write_close();

exit();

}
}
}
}
?>

Next is the home.php page where when the user has sign up or login, it will take him into the home.php page where he can send and receive emails, search for emails and edit account. please take note that the home.php page will be used throughout the upcoming steps in this tutorial.

//Below is the home page that the newly register user will be taken after registration is complete. // include the below php script at the top of the in the home.php page

session_start();
include("connection.php"); //connect to the database
include("function.php"); //This is the include file above indicated above
?>

 


welcome to 23tutorials.com social network learning script for newbie programmers.
Hopes you enjoyed this tutorial.
Follow all the above email tutorials and you will benefit and learn new trick to create your own social network. Thanks

Login script

This is the login form where user can login. Below is the database where all the user information is kept which will be used for the login process.

Below is the database for the login process.

 

CREATE TABLE IF NOT EXISTS `member` (
`member_id`int(11) NOT NULL AUTO_INCREMENT,
`firstname` varchar(30) NOT NULL,
`secondname` varchar(30) NOT NULL,
`email` varchar(30) NOT NULL,
`sex` varchar(100) NOT NULL,
`password` varchar(30) NOT NULL,
`profile_picture` varchar(30) NOT NULL,
`day` varchar(100) NOT NULL,
`month` varchar(30) NOT NULL,
`year` varchar(100) NOT NULL,
PRIMARY KEY (`member_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;

 

Next create a page called index.php which will contain the login form in the page.

Below is the index.php having the login form

session_start();
//Unset the variables stored in session
unset($_SESSION['SESS_MEMBER_ID']);
unset($_SESSION['SESS_FIRST_NAME']);
unset($_SESSION['SESS_LAST_NAME']);
?>

Next is the php file call “loginscript.php” which will login the registered user into the database which he will be taken to the home.php page.

//Start session
session_start();
//Include database connection details
require_once('connection.php');
//Array to store validation errors
$errmsg_arr = array();
//Validation error flag
$errflag = false;
//Function to sanitize values received from the form. Prevents SQL injection
function clean($str) {
$str = @trim($str);
if (get_magic_quotes_gpc()) {
$str = stripslashes($str);
}
return mysql_real_escape_string($str);
}
//Sanitize the POST values
$email = clean($_POST['login_email']);
$password = clean($_POST['login_password']);
//Input Validations
if ($email '') { $errmsg_arr[] = 'email missing'; $errflag = true; } if ($password '') {
$errmsg_arr[]= 'Password missing';
$errflag = true;
}
//If there are input validations, redirect back to the login form
if ($errflag) {
$_SESSION['ERRMSG_ARR'] = $errmsg_arr;
session_write_close();
header("location: index.php");
exit();
}
//Create query
$qry="SELECT * FROM member WHERE email='$email' AND password='$password' ";
$result=mysql_query($qry);
//Check whether the query was successful or not
if ($result) {
if (mysql_num_rows($result) > 0) {
//Login Successful
session_regenerate_id();
$member = mysql_fetch_assoc($result);
$_SESSION[‘SESS_MEMBER_ID’] = $member[‘member_id’];
$_SESSION[‘SESS_FIRST_NAME’] = $member[‘email’];
$_SESSION[‘SESS_LAST_NAME’] = $member[‘password’];
session_write_close();
header(“location: home.php”);
exit();
} else {
//Login failed
$errmsg_arr[] = ‘email and password not found’;
$errflag = true;
if ($errflag) {
$_SESSION[‘ERRMSG_ARR’] = $errmsg_arr;
session_write_close();
header(“location: index.php”);
exit();
}
}
} else {
die(“Query failed”);
}
?>

 

Next is the home.php page where when the user has sign up or login, it will take him into the home.php page where he can send and receive emails, search for emails and edit account. plesae take note that the home.php page will be used throughout the upcoming steps in this tutorial.

//Below is the home page that the login user will be taken after login is completed. // include the below php script at the top of the in the home.php page

 

 

 

 

 

 

 

session_start();
include("connection.php");//connect to the database
include("function.php");//This is the include file above indicated above
?>

 


welcome to 23tutorials.com social network learnig script for newbies programmers.
Hopes you enjoyed this tutorial.
Follow all the above video social network tutorials and you will benefit and learn new trick to create your own social network. Thanks

Show user profile name / photo script

This is the view profile names and photo script where the login user can view his profile names and photo.

Below is the database for the storing the uploaded profile names and photo.

CREATE TABLE IF NOT EXISTS `member` (
`member_id`int(11) NOT NULL AUTO_INCREMENT,
`firstname` varchar(30) NOT NULL,
`secondname` varchar(30) NOT NULL,
`email` varchar(30) NOT NULL,
`sex` varchar(100) NOT NULL,
`password` varchar(30) NOT NULL,
`profile_picture` varchar(30) NOT NULL,
`day` varchar(100) NOT NULL,
`month` varchar(30) NOT NULL,
`year` varchar(100) NOT NULL,
PRIMARY KEY (`member_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;

Next create a page called home.php that shows the profile names and picture.

session_start();
include ("connection.php"); // connect to the database
include("function.php"); //connect the login user session
?>

<?php

/* select the names of the login from the database */

$member_id = $_SESSION[“logged”];

$result = mysql_query(“SELECT * FROM `member` WHERE `member_id`=’$member_id’ LIMIT 1”);

echo “

“;

while($row = mysql_fetch_array($result))

{

echo “

“;

echo ““;

echo “

“;

echo “

“;

}

echo “

“ . $row[‘firstname’] .’ ‘. $row[‘secondname’] . “
“;

?>

How to search emails script

This is the search emails script where the login user can search for emails he wan t to mails to.

Below is the database for the storing the uploaded profile names and photo.

CREATE TABLE IF NOT EXISTS `member` (
`member_id`int(11) NOT NULL AUTO_INCREMENT,
`firstname` varchar(30) NOT NULL,
`secondname` varchar(30) NOT NULL,
`email` varchar(30) NOT NULL,
`sex` varchar(100) NOT NULL,
`password` varchar(30) NOT NULL,
`profile_picture` varchar(30) NOT NULL,
`day` varchar(100) NOT NULL,
`month` varchar(30) NOT NULL,
`year` varchar(100) NOT NULL,
PRIMARY KEY (`member_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;

Next create a page called home.php that contains the search form that will show the result of the search emails.

session_start();
include ("connection.php"); // connect to the database
include("function.php");
?>


Create a file called search.php which will search the emails from the database.

<?php

include(‘connection.php’);

if($_POST)

{

$query = mysql_real_escape_string($_POST[‘search’]);

$sql = mysql_query(“SELECT * FROM `member` WHERE `email` LIKE$queryLIMIT 0, 5 “) or die (mysql_error());

$num_of_row = mysql_num_rows($sql);

if ($num_of_row > 0 ) {

while($row = mysql_fetch_array($sql))

{
$id = $row[‘member_id’];

echo “

 “. $row[‘email’].”

“;

echo “


“;

}
}
else
{
echo “No email found!“;

}
}
?>

How to compose email script

This is the form for sending emails. The form can send files alongside the email.

Below is the database that stores the emails.

CREATE TABLE IF NOT EXISTS `emails` (
`email_id` int(11) NOT NULL AUTO_INCREMENT,
`sender_id` int(11) NOT NULL,
`receiver_id` int(11) NOT NULL,
`sender_email` varchar(5000) NOT NULL,
`receiver_email` varchar(5000) NOT NULL,
`subject` varchar(5000) NOT NULL,
`file_name` varchar(5000) NOT NULL,
`email_body` varchar(5000) NOT NULL,
`date` date NOT NULL,
PRIMARY KEY (`email_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=9;

Next create a page called home.php that contains form for sending emails.

<?php

session_start();
include (“connection.php”); // connect to the database
include(“function.php”);

?>

Create a file called send-mail.php which will insert the email the login user sends into the database.

<?php

session_start();

include(“connection.php”);

include(“function.php”);

$mail = $_POST[“email_body”];
$receiver = $_POST[‘receiver_email’];
$subject = $_POST[“topic”];
$member_id = $_SESSION[“logged”];
$sender_email = $_email[“logged”];
$send_file = $_FILES[‘file’][‘name’];
if( $send_file == “” )
{

$query = mysql_query(“INSERT INTO emails(sender_id,date,sender_email,receiver_email,subject,file_name,email_body)
VALUES,’$sender_email’,’$receiver’,’$subject’,’$send_file’,’$mail’) “);
echo ““;

}else{

$path = “files/”; //the files is the name of the folder to store the file attach or send to an email.
$valid_formats = array(“docx”, “pdf”, “gif”, “bmp” , “JPG” , “PNG” , “GIF”,“jpg”, “png”,“sql”);
$send_file = $_FILES[‘file’][‘name’];
list($txt, $ext) = explode(“.”, $send_file);
if(in_array($ext,$valid_formats))
{

$tmp = $_FILES[‘file’][‘tmp_name’];
if(move_uploaded_file($tmp, $path.$send_file))
{

$query=mysql_query(“INSERT INTO emails(sender_id,date,sender_email,receiver_email,subject,file_name,email_body)
VALUES,’$sender_email’,’$receiver’,’$subject’,’$send_file’,’$mail’) “) or
die(mysql_error());
} else

{

echo ““;

}

{

echo ““;

}
} else{
echo ““;
}
}
?>

How to view inbox email script

This is the view profile names and photo script where the login user can view his profile names and photo.

Below is the database for the storing the inbox emails (messages).

CREATE TABLE IF NOT EXISTS `emails` (
`email_id` int(11) NOT NULL AUTO_INCREMENT,
`sender_id` int(11) NOT NULL,
`receiver_id` int(11) NOT NULL,
`sender_email` varchar(5000) NOT NULL,
`receiver_email` varchar(5000) NOT NULL,
`subject` varchar(5000) NOT NULL,
`file_name` varchar(5000) NOT NULL,
`email_body` varchar(5000) NOT NULL,
`date` date NOT NULL,
PRIMARY KEY (`email_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=9;

Next create a page called home.php that shows the inbox message (emails received by the login users).

session_start();
include ("connection.php"); // connect to the database
include("function.php");
?>

<?php

$user_email = $_email[“logged”];

$email = mysql_query(“SELECT * FROM `emails` WHERE `receiver_email`=’$user_email’ ORDER BY date DESC”);

$num_rows =mysql_numrows($email);

if ($num_rows != 0 ) {

while($row = mysql_fetch_array($email))

{
$email_file = $row[“file_name”];

$email_text = $row[“email_body”];

$mail = substr($email_text , 0, 15);

if($email_file)

{
echo”

“;

echo’

From: ‘.$row[“sender_email”].’

‘;

echo’

‘;

echo’

draft email

‘;

echo’

‘;

echo’

‘;

echo”

“;

echo”

“;

} else

{

echo”

“;

echo’

From: ‘.$row[“sender_email”].’

‘;

echo’

draft email

‘;

echo’

‘;

echo’

‘;

echo”

“;

echo’

Delete

‘;

echo”

“;

}
}
} else {
echo”

“;

echo”

No message received yet.

“;

echo”

“;

}
?>

How to view full email script

This is the view full email script where the login user can view the complete email content when he clicks any email on the inbox.

Below is the database for the storing the inbox emails (messages).

CREATE TABLE IF NOT EXISTS `emails` (
`email_id` int(11) NOT NULL AUTO_INCREMENT,
`sender_id` int(11) NOT NULL,
`receiver_id` int(11) NOT NULL,
`sender_email` varchar(5000) NOT NULL,
`receiver_email` varchar(5000) NOT NULL,
`subject` varchar(5000) NOT NULL,
`file_name` varchar(5000) NOT NULL,
`email_body` varchar(5000) NOT NULL,
`date` date NOT NULL,
PRIMARY KEY (`email_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=9;

Next create a page called home.php that shows the inbox message (emails received by the login users).

session_start();
include ("connection.php"); // connect to the database
include("function.php");
?>

<?php

$user_email = $_email[“logged”];

$email = mysql_query(“SELECT * FROM `emails` WHERE `receiver_email`=’$user_email’ ORDER BY date DESC”);

$num_rows =mysql_numrows($email);

if ($num_rows != 0 ) {

while($row = mysql_fetch_array($email))

{
$email_file = $row[“file_name”];

$email_text = $row[“email_body”];

$mail = substr($email_text , 0, 15);

if($email_file)

{
echo”

“;

<?php

$email = mysql_query(“SELECT * FROM `emails` WHERE `email_id`=’$email_id’ “);

while($row = mysql_fetch_array($email))

{
$email_file = $row[“file_name”];

if($email_file)

{
echo”

“;

echo’

From: ‘.$row[“sender_email”].’

‘;

echo’

‘;

echo’

‘;

echo’

‘.$row[“email_body”].’

‘;

echo”

“;

} else
{
echo”

“;

echo’

From: ‘.$row[“sender_email”].’

‘;

echo’

‘;

echo’

‘;

echo’

‘.$row[“email_body”].’

‘;

echo”

“;

}
}
?>

Please follow the remaining chapters of this tutorial at www.23tutorials.com for free and many more tutorials like how to create YouTube, Facebook, twitter and many more.

Thanks for following this video sharing social network tutorial ebook.

You are allowed to share this ebook with your friends or colleagues. We have many tutorials like;

How to create Facebook in php and JavaScript,

How to create twitter in php and JavaScript,

How to create Gmail in php and JavaScript

And many more free tutorials all for free.

We also have plug-in like who is online (showing online users),

Facebook search engine tutorials and many more for free.

Visit our website www.23tutorials.com and get all the tutorials that you want, you can even request a tutorial and will help you.

Follow more tutorials at www.23tutorials.com Page 65

 


Gmail tutorials

learn how to create gmail in php and JavaScript

  • Author: ndicho albert
  • Published: 2016-09-17 02:05:20
  • Words: 4072
Gmail tutorials Gmail tutorials