how to make an email from a website using php code example

Example 1: how to send email with php

<?php     
  

  var Name = $_POST('name');
  // grabbing the data from the form when posted
  // make sure to add name="name" or name="email"
  // in the input tag to grab the the specific elements
  // data example <textarea name="message"> or 
// <input type="number name="number">
  
  var Email = $_POST('email');
  var Number = $_POST('number');
  
$to_email = 'Your E-mail';
$subject = 'The Subject of the message';
$message = 'Name'.$name. "email" .$email. "number:" .$number.".";
$headers = 'From: noreply @ company . com'; //optional
mail($to_email,$subject,$message,$headers);
?>

Example 2: read an email with php

//docs
https://www.php.net/manual/en/book.imap.php

https://garrettstjohn.com/articles/reading-email-php/

Example 3: Sending an php website email form

<form method="post" action="subscriberform.php">
<textarea name="message"></textarea>
<input type="submit">
</form>