Question:
I have a website under construction that people have the possibility to enter an email on, I would like that as soon as they enter their email and click the "subscribe" button, an autoresponder email would be sent to them, how could I do this?
Answer:
Give PHP's mail function a read. If you are using a standard hosting it must be pre-configured.
With the mail
function working, you just create an HTML form to perform this action.
A Basic Usage Example
index.html
<form method="post" name="meu-form" action="send-mail.php">
Nome: <input type="text" name="nome">
Email: <input type="text" name="email">
Mensagem: <textarea name="mensagem"></textarea>
<input type="submit" value="Enviar">
</form>
send-mail.php
<?php
$nome = $_POST['nome'];
$email= $_POST['email'];
$mensagem= $_POST['mensagem'];
$to = "contato@exemplo.com.br";
$assunto = "Mensagem de ".$email.com
mail($to,$assunto,$mensagem);
?>