It will depend with the server you are working with. Some will accept the simple example provided below. Adding the PHP code for sending the mail
<?php
if (isset($_POST['nama']) && ((isset($_POST['nama']) != ""))) {
$nameofsender = $_POST['nama'];
$to = 'myemail@gmail.com';
$message = $_POST['mail'];
$body ='<html>
<body>
<div class="content">
<p style="text-align:center;">'.$message.'<p><br />
</div>
</body>';
$headers='MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html;charset=iso-8859-1' . "\r\n";
$headers .= 'From: MY BLOG <info@myblog.com>' . "\r\n";
$subject = "$nameofsender - Message from blog";
//mail function
$mail = mail($to, $subject, $body, $headers);
if(!$mail) {
echo "Error sending email";
}
else {
echo "Your email was sent successfully.";
}
}
?>
YOUR FORM......
Some servers are strict more so windows based servers and may require more detail before sending mails like the code below
/*email starts*/
require_once "http://www.yourblog.com/Mail.php";
$from = "Your blog <info@yourblog.com>";
$email = 'myemail@gmail.com';
$to = "<$email>";
$subject = "$nameofsender - Message from blog";
$message = $_POST['mail'];
$body = $body ='<html>
<body>
<div class="content">
<p style="text-align:center;">'.$message.'<p><br />
</div>
</body>';
$host = "mail.yourwebsite.com";
$username = "info@yourwebsite.com";
$password = "passwordtousernameabove";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject);
$smtp = Mail::factory('smtp',
array ('host' => $host,
'port' => 25,
'auth' => true,
'username' => $username,
'password' => $password));
$mail = $smtp->send($to, $headers, $body);
if (PEAR::isError($mail)) {
echo("<p>" . $mail->getMessage() . "</p>");
} else {
echo("<p>Message successfully sent!</p>");
}
YOUR FORM....
For better understanding google for tutorials on this topic as it is a shot but wide interesting topic. Regards