#INDEX.PHP
<!DOCTYPE html>Step 2:- When you run it on browser it will look like this:-
<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 3:- Now create mail.php page as follow:-
#MAIL.PHP
<?phpStep 3:- Now input your correct mail it or name into input box and submit it.
$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-\r\n"."Content-Type: application/zip;
name=\.$attachment.\"\r\n"."Content-Transfer-Encoding:
base64\r\n"."Content-Disposition: attachment\r\n\r\n";
$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.'' . "\r\n" .
'Reply-To: '.$EMAIL.'' . "\r\n" .
'Content-type: text/html; charset=utf-8' . "\r\n" .
'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 4:- If mail has sent, you will get message:-
Mail send... OKStep 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.
2 comments
Write commentsPlz give me a mail server project in php
Replyhave you tried the process of mail sending as I posted????
ReplyNote: Only a member of this blog may post a comment.