How to email the content written in a <textarea></textarea>?

Asked

Viewed 400 times

-1

I would like to know, if there is a script, a way to send the content contained in the "textarea" to an email. Thanks in advance!

  • Show the code you developed.

1 answer

0


You can take the value of <textarea> by the method POST of Form, example:

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

And then pick up with the $_POST php:

$conteudo = $_POST['texto'];

And send the email normally:

mail($destinatario, $assunto, $conteudo, "From: [email protected]");
//Onde a variavel $assunto contem o assunto do email e $destinatario, pra quem o email será enviado

Don’t forget to set up php.ini!

Behold that, if you have more questions. Or official documentation.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.