Click here to Skip to main content
15,889,931 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

I have created a html page with comment box, when the user entered some comment and clicked on submit, it should come to my gmail account.

Please give me the code how to do it.
Posted

For goodness sake: no JavaScript, no client-side. You can do it reliably and safely only using some server-side technology: ASP.NET, Python with WSGI, PHP after all. On the client side you only need a form with data needed for a mail, it should use the HTTP method "POST". The server side should get the posted data and send a message based on it.

A big warning! You should not send data, especially headers as is. Programmatically, it's way too easy to turn your server into a zombie sending spam if not worse. Filter our anything suspicious from headers, all non-printing characters, HTML or script codes, etc. If such thing happens, log the information about the even as an attempt of malicious activity and investigate such cases. It happens too often.

[EDIT]

Here is my recent article explaining the exploit in more detail:
unable to send mail , it showing the error in below code .[^].

Take care!

[END EDIT]

And forget JavaScript and client-side. This way, you make it completely open for malicious activity. Also, you cannot assume any particular software installations on the user's client system. Just forget the idea.

—SA
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900