How to make a php from mail

To send an email using PHP, you can use the mail() function, which is a built-in PHP function. Here is an example of how to use it:

<?php
$to = '[email protected]';
$subject = 'Test email';
$message = 'This is a test email sent using PHP';
$headers = 'From: [email protected]'. "\r\n".
    'Reply-To: [email protected]'. "\r\n".
    'MIME-Version: 1.0'. "\r\n".
    'Content-Type: text/plain; charset=UTF-8';

mail($to, $subject, $message, $headers);
?>

This code sends an email to the recipient at [email protected] with the subject "Test email" and the message "This is a test email sent using PHP". The email is sent from the sender at [email protected].

You can also use the PHPMailer library, which is a popular and powerful email sending library for PHP. Here is an example of how to use it:

<?php
require 'PHPMailer/PHPMailer.php';
require 'PHPMailer/SMTP.php';

$mail = new PHPMailer\PHPMailer\PHPMailer();
$mail->isSMTP();
$mail->Host = 'smtp.example.com';
$mail->SMTPAuth = true;
$mail->Username = '[email protected]';
$mail->Password = 'password';
$mail->setFrom('[email protected]', 'Sender Name');
$mail->addAddress('[email protected]', 'Recipient Name');
$mail->Subject = 'Test email';
$mail->Body = 'This is a test email sent using PHPMailer';
$mail->send();
?>

This code sends an email to the recipient at [email protected] with the subject "Test email" and the message "This is a test email sent using PHPMailer". The email is sent from the sender at [email protected].

You can also use the SwiftMailer library, which is another popular email sending library for PHP. Here is an example of how to use it:

<?php
require 'SwiftMailer/Swift.php';

$mail = new Swift_Mailer();
$mail->setFrom('[email protected]', 'Sender Name');
$mail->addAddress('[email protected]', 'Recipient Name');
$mail->Subject = 'Test email';
$mail->Body = 'This is a test email sent using SwiftMailer';
$mail->send();
?>

This code sends an email to the recipient at [email protected] with the subject "Test email" and the message "This is a test email sent using SwiftMailer". The email is sent from the sender at [email protected].

Note that in all cases, you need to replace the placeholders ([email protected], [email protected], etc.) with the actual email addresses and other details you want to use.