简体   繁体   中英

How do i automatically send an email after user submit their email address in the newsletter form?

I want to automatically send an email that says "thank you for signing up for our newsletter form. If you have any questions please email kundeservice@.....no

I have tried multiple different codes that I tried to change but nothing has worked. I need to use the $_GET['epost'] so I send it correctly to the email.

I am not sure if I need to install something on the terminal. Currently using ubuntu 18.04

HTML:

<form name="form" class="forms" action="/backup/formsend.php" id="formn" method="post" >
    <div class="email">
        <input type="text" name="epost" id="epost" placeholder="E-Post" required>
    </div>

    <div class="submitknapp">
        <input class="knapp" type="submit" name="submit" value="Send"></input>
    </div>
</form>

you need to save this form inputs into your database, then you will send him a welcome email, so you will use phpmailer library if you write pure PHP it's so simple https://github.com/PHPMailer/PHPMailer

<?php
    $email = $_POST['epost'];
    $email_subject = "News letter";
    $email_content = "thank you for signing up for our newsletter form. If you have any questions please email kundeservice@.....no";
    mail($email,$email_subject,$email_content);
?>

mail() function is used to send email to mentioned email address.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM