Yesterday I discovered how to send e-mails using php. I didn’t think sending e-mails is such an easy thing. But thanks to php mail function it’s easier than one could ever imagine the code is as follows,
$to_addr = ‘email@example.com’;
$mail_body = ‘Name: ‘.$_REQUEST[‘name’];
$mail_body .= “\nEmail: “.$_REQUEST[’email’];
$mail_body .= “\nMessage: “.$_REQUEST[‘message’];
print “Thank you for the feedback.”;
<form method=”POST” action=”$_SERVER[PHP_SELF]”>
<tr><td>Name:</td><td><input type=”text” name=”name”></td></tr>
<tr><td>Email:</td><td><input type=”text” name=”email”></td></tr>
<tr><td colspan=”2″><input name=”submit” type=”submit”></td></tr>
Nowerdays everybody is used to have a feedback form in their site regardless of the capacity of the site. Hope this piece of code will be useful to you. I think one could play around with this(php mail function) and come up with even more interesting applications of this, than a mere Feedback.
Let us break the barrier in sending e-mails.