Step 1:- Create a html form to take input from user as follow:-
#INDEX.PHP
<!DOCTYPE html>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<title></title>
</head>
<body>
<div style=”width:600px; margin:0 auto;”>
<form action=”mail.php” method=”get”>
<table>
<tr>
<td>Customer Name </td>
<td>
<input type=”text” id=”CustName” name=”CustName” required />
</td>
</tr>
<tr>
<td>Customer Mail ID </td>
<td>
<input type=”text” id=”toMailID” name=”toMailID” required/>
</td>
</tr>
<tr>
<td>Attach file</td>
<td>
<input type=”file” name=”upload” id=”upload” />
</td>
</tr>
<tr>
<td>
</td>
<td>
<input type=”submit” value=”Submit” />
</td>
</tr>
</table>
</form>
</div>
</body>
</html>
Step 2:- When you run it on browser it will look like this:-
Step 3:- Now create mail.php page as follow:-
#MAIL.PHP
<?php
$companyContactNo = ‘your contact number’;
$CustName = $_REQUEST[‘CustName’];
$companyName = ‘abc Infotech Pvt. Ltd.’;
$companyEmailID = ‘comapnay mail id’;
$file = $_REQUEST[‘upload’];
$toMailID = $_REQUEST[‘toMailID’];
//declare our variables
$EMAIL = ‘your mail id’; //Set ThiFrom Mail ID
//get todays date
$todayis = date(“l, F j, Y, g:i a”) ;
//set a title for the message
$subject = “Inquiry from vatikasovereignpark.com Minisite”;
$attachment = $file;
//include attachment
$body =”–PHP-mixed-rn”.”Content-Type: application/zip;
name=.$attachment.”rn”.”Content-Transfer-Encoding:
base64rn”.”Content-Disposition: attachmentrnrn”;
$body .= $attachment;
$body = “
<html>
<head>
</head>
<body>
<div style = ‘border-top:3px solid #22BCE5’> </div>
<p>Dear $CustName </p>
<p>Thank you for Contacting $companyName. </p>
<p>We have started working on your computer problems reported to our team. We hope to fix your computer issues at earliest and will update you shortly.</p>
<p>When you call, please have below information handy so that we can expedite your request.</p>
<br/>
<b>Regards</b><br/>
<p>Hacxad Infotech Pvt. Ltd</p>
<p>EmailID – $companyEmailID</p>
<p>Contact No – $companyContactNo</p>
</body>
</html>”;
$headers = ‘From: ‘.$EMAIL.” . “rn” .
‘Reply-To: ‘.$EMAIL.” . “rn” .
‘Content-type: text/html; charset=utf-8’ . “rn” .
‘X-Mailer: PHP/’ . phpversion();//put your email address here
$status = mail($toMailID, $subject, $body, $headers);
if($status){ echo “mail send … OK”;
//header(‘Location:index.php’);
}
else{ echo “mail send … ERROR!”; }
?>
Step 3:- Now input your correct mail it or name into input box and submit it.
Step 4:- If mail has sent, you will get message:-
Mail send… OK
Step 5:- If mail is not send on your mail id due to any error, you will get message:-
mail send …ERROR!
So using above process you can send e-mail on any type of mail id.
Plz give me a mail server project in php
have you tried the process of mail sending as I posted????