Send form data with PHP Mailer without entering an email address in the form?
Hello,
I want to send a form for private purposes, but without including an email address in the form. As far as I can remember, you could assign the corresponding email address to the code in the editor, and all form data would be automatically sent to it.
I would be very grateful if you could help me 🙏
Of course, I can help you create a form that sends data with PHP mailer without the recipient’s email address being visible in the form itself. Instead, the recipient’s email address is set directly in the PHP code that processes the form. Here is a basic example of how you can do this:
Step 1: Create your HTML form
First create your HTML form without a field for the email address. Here is a simple example:
Step 2: Edit and send data with PHP mailer
Create a PHP file (in this example)
), which processes the data of the form and sends it with PHP mailer. You need to install PHP mailers in your project if you haven’t done this yet. You can install PHP mailers with Composer or integrate the required files directly into your project.
Here is a simple example for
:
In this PHP script:
When the form is sent, the data will be sent to
sent, and the PHP script uses PHP mailer to send the data to the specified email address without the email address appearing in the form itself.
https://innowise.com/en/php-development services/
Thank you very much!
The PHPMailer-Instance, you can use the recipient address AddAddress– Provide method. See the example on the GitHub page of PHPMailer on.
Thank you.