How to automatically send an email after a form submission? [Beginner]

Hi,

I’m a student currently doing my final project. I’m building an internal event management system for the university and I am stuck with a form feature.

I want a student user to be able to fill in a form details to submit an event proposal to the website. Once “submit” is clicked, I want the website to automatically fetch all the details sent by the student user through the form and send a reference copy via email. This is the first requirement.

The second one would be on, how to keep all the student user’s form submission details in his/her profile for future edition?

Really need some help here. I tried SMTP for emails and everything, but still pretty confused as to how it functions and nothing turned out. I’m using WAMP localhost.

Thank you very much in advance.

1
You could (should?) use PHPMailer, it allows you to ie use your gmail account credentials to send email instead of messing around with lots of server settings.

2
save the form submission to the database, include a fk to the user id so you can query for submission later to show in the user profile

Hi Jim,

Thanks for your help. just to clarify, for PHP mail() function, does it only work after hosting it on a website or will it be able to work from a WAMP localhost? I read somewhere that it works only on a hosted site. Hope to hear from you soon :slight_smile:

Thanks!

mail() will work if you’ve configured the server (hosted or WAMP) correctly. Note that mail() is not the same as the far superior PHPMailer (mail() doesn’t even give you any error messages if something fails)

Sponsor our Newsletter | Privacy Policy | Terms of Service