I am new to WordPress. I have created a custom template with a form. This form will get information like first name, last name, and message from visitors. I want to forward this visitor information to another email such as "test@mail.com". This email address will be a dynamic one. How can I do this in WordPress? Thanks in advance.


The easy way would install this plugin - https://da.wordpress.org/plugins/contact-form-7/ - It's super easy to work with, and it will do what you want :)

If you don't want to use a plugin, then you would just code a contact form with html and php.


  $firstname = $_POST['firstname'];
  $lastname = $_POST['lastname'];
  $from = $_POST['email'];
  $message = $_POST['textarea'];

  $to = "somebody@example.com";
  $subject = "My subject";
  $message = "Hello world!";
  $headers = "From: " . $email . "\r\n" .
  "CC: somebodyelse@example.com";



<form action="" method="post">
    First name:<br>
    <input type="text" name="firstname">
    Last name:<br>
    <input type="text" name="lastname">
    Email: <br>
    <input type="email" name="email">
    <input type="text" name="subject">
    <textarea name="textarea" id="" cols="30" rows="10"></textarea>
    <input type="submit" value="Submit">

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.