<!DOCTYPE unspecified PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Sending Email using PHP : Code2care Examples</title>
</head>
<body>
<form action="EmailSender.php" method="post">
To : <input name="to" type="text" />
<br/><br/>
Subject : <input name="subject" type="text" />
<br/><br/>
From : <input name="from" type="text" />
<br/><br/>
Body : <textarea name="body" rows="25" cols="100"></textarea>
<input type="submit" value="submit">
</form>
</body>
</html>
Below is the PHP file that is called when the form is submitted,
<?php
$mailTo = $_POST['to']."\r\n";
$mailSubject = $_POST['subject']."\r\n";
$mailBody = $_POST['body']."\r\n";
$mailHeaders = "From: ".$_POST['from']."\r\n";
$mailHeaders .= "Reply-To: emailID@yourdomain.com \r\n";
$mailHeaders .= "Return-Path: emailID@yourdomain.com \r\n";
$mailHeaders .= "X-Mailer: PHP5 \r\n";
$mailHeaders .= 'MIME-Version: 1.0' . "\r\n";
$mailHeaders .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
//Send Email Function
mail($mailTo,$mailSubject,$mailBody,$mailHeaders);
?>
- PHP Code for sending Emails
- PHP drag and drop file upload tutorial using dropzone.js
- Delete file using PHP code : unlink()
- Save current timestamp in MySQL using PHP mysqi binding
- Failed to load resource: net::ERR_CACHE_MISS PHP
- PHP Warning: Cannot modify header information - headers already sent
- PHP header location function not called
- How to destroy PHP session()
- Upload docx file using PHP script
- Call PHP function on Button click using jquery ajax
- Upload Pdf file using PHP Script
- 403 forbidden error for Image
- PHP Base64 encoding decoding a variable
- PHP 301 Redirect Permanently
- Copy file from one directory to other in Php
- PHP Script to Upload Images to Server
- Installing vue.js in Laravel 8
- PHP Fatal error : Call to a member function bind_param() on a non-object
- PHP.ini: How to Remove URL Forward Slash Before Single or Double Quotes
- macOS - cannot calculate MAC address: Using fd 9 hv_vm_create HV_ERROR [PHP XAMPP]
- How to search (find) in macOS Terminal Console Text - MacOS
- Docker Desktop needs privileged access macOS - MacOS
- How to check zsh installed version using terminal - MacOS
- CentOS Cannot find a valid baseurl for repo base7x86_64 yum - HowTos
- PHP drag and drop file upload tutorial using dropzone.js - PHP
- Installing Microsoft Edge on M1/M2 Mac - Microsoft
- Copy file from one directory to other in Php - PHP
- Telegram down in Europe - users facing connection issues and 500 Internal Server error - News