PHP Mail
PHP Mail
Aim:
To develop a PHP program to make use of PHP mail services to send and receive
messages.
Program:
<?php
require 'PHPMailer/PHPMailerAutoload.php';
if(isset($_POST['submit'])){
$name = $_POST['name'];
$femail = $_POST['femail'];
$toemail = $_POST['email'];
$subject = $_POST['subject'];
$bodycontent = $_POST['message'];
$mail->setFrom($femail, $name);
$mail->addReplyTo($femail, $name);
$mail->Subject = $subject;
$mail->Body = $bodycontent;
$mail->AddAttachment($_FILES['image']['tmp_name'], $_FILES['image']['name']);
if(!$mail->send()) {
} else {
?>
<html>
<body>
<table>
<tr>
<div id="invalid-name"></div>
</td>
</tr>
<tr>
</td>
<tr>
<div id="invalid-email"></div>
</td>
</tr>
<div id="invalid-femail"></div>
</td>
</tr>
<tr>
</tr>
<tr>
</tr>
<tr>
<table>
</form>
</body>
</html>
Output:
Conduct of Experiment (30)
Record(20)
Viva(10)
Total(60)
Result:
Thus, the development of PHP program to send and receive email has been done
successfully.