How to send email from a form ?
I had asked this question a few days ago myself. And have been scouting
google for the answer. To be honest, I did get quite a few answers.
But, the problem lay in finding the compatible tool for my installation.
My limitations were:
- I do not own the server
- I cannot install or uninstall any tool on to the server
- The server help was not very familiar with the installation either
- I had to scout the server details (info like the MTA used by the server)
So, was born a script that does not rely on the server configuration, for sending mail.
This script is in php (I tried to use the formmail script, but found that
this is easier) and relies on direct communication with the SMTP server to send mail.
The script uses SMTP AUTHentication for sending mail. This script assumes that you are using the Exim MTA for your email transport.
As you see in the script, though the SMT Protocol (SMTP) is standard, the request and response for different servers are slightly different and the script may have to be modified to suit your server. As mentioned, this
script is for the Exim MTA with SMTP AUTH.
SMTP AUTH means that you can post a message ONLYy after you have identified yourself to the server, meaning that you have to be an authenticated user on your server.
Hopefully, this helps!
Note:
If the php server is not configured correctly, variables defined in the html form may not pass properly into the php document, which is why the "track_vars" is used.
In addition, the phrase $HTTP_POST_VARS["b_first"] creates the appropriate variable in the document that was passed through the form, but was not visible due to some misconfiguration at the server.
Download the "form to email" script below:
form2mail script in a zipped file
Subscribe to:
Post Comments (Atom)
Imagen 3: A New Era of AI Image Creation?
Google has just unveiled Imagen 3, the latest iteration of their Gemini AI. They're making bold claims about enhanced image quality, ...
Most Popular
-
Steps to install wkhtmltopdf in Centos 7 Redhat Linux As you may know, wkhtmltopdf is a tool that is used to create a pdf on the fly fro...
-
The East Coast Road! It is advertised as a route with scenic splendour. It can take you from Chennai to Pondicherry in no time. It can al...
-
Error: Connection timed out after 20 seconds of inactivity I just want to share a peculiar sftp connectivity issue that we encount...
-
How do we read signs and omens in everyday life This article is part one about about experimenting with the inherent power of the human ...
-
There is some news for those using the national highway NH 48, especially the Chennai Bengaluru section. There has been an introductio...
No comments:
Post a Comment