How to send an email after form submitted
In many cases, we want to send 2 emails after an inquiry form submitted.
- One email is to notify the admin(or manager) there was an inquiry submitted and the admin can reply directly via email
- Another email is to inform the customer(inquiry submitter) that his/her inquiry has been received
How to send an email after form submitted?
- You will need to config your .env to set up proper send email parameters. eg. SMTP server, username/password
- Set up the proper MAIL_FROM_ADDRESS in the .env to avoid spam
- You should already have the above settings done if it's an existing Laravel project. Then go to the default inquire form setting section(usually is under the homepage)
- Set up below things:
- What will be displayed after the form is submitted successfully (This is the email body content)
- The inquiry received email subject send to the submitter (This is the email subject)
- Inquiry submitter reply email to this email address (By default it use the MAIL_FROM_ADDRESS in the .env, but you can change it)
Now, everything is ready, you can have some test afterward.
Email example for the customer(inquiry submitter)
Email example for the admin:
Joe,We've got your inquiry Thank you for submitting the inquiry! We will contact you in 3 working days! Hey there, Just want to know do you provide a hosting service for the Laravel CMS? Joe
You have got an inquiry from Joe Hey there, Just want to know do you provide a hosting service for the Laravel CMS? Joe