eckrothmusic
asked on
htlm or java script code to send email
I would like to put embedded code in a web page so that if someone visited that page on our website it would send an email to a given address.
I don't want to have any submit buttons or anything visible to the web page visitor. I want it to happen behind the scene.
I don't want to have any submit buttons or anything visible to the web page visitor. I want it to happen behind the scene.
If you are loking to track visitors, there are better methods. THe code above will do what you asked, but if someone visits the same page multiple times, you'll get multiple e-mails.
You're better off setting a cookie value of the vistor's IP address and writing the visit to a database. Then on re-visits, you can check for the presence of the cookie value and determine whether to write to the db or not.
Maybe you don't want to counrt visits back to the same page by the same user within 1/2 hour or something like that.
You're better off setting a cookie value of the vistor's IP address and writing the visit to a database. Then on re-visits, you can check for the presence of the cookie value and determine whether to write to the db or not.
Maybe you don't want to counrt visits back to the same page by the same user within 1/2 hour or something like that.
ASKER
ok. this looks good!
I am actually putting this on an error page so that I am notified if a user gets this page.
Question: in your code where do I change the frommail and tomail to the actually email addresses?
I am actually putting this on an error page so that I am notified if a user gets this page.
Question: in your code where do I change the frommail and tomail to the actually email addresses?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks!
You're welcome.
Everywhere you see to@domain.com, substitute with your desired e-mail address.
Everywhere you see from@domain.com, substitute with your desired e-mail address.
Everywhere you see from@domain.com, substitute with your desired e-mail address.
Does the error page accept input from the user from another page?
Are their variables you're expecting to be POSTed?
YOu can include those in the e-mail...
Are their variables you're expecting to be POSTed?
YOu can include those in the e-mail...
You will need a scripting language such as ASP.NET or PHP.
Here is some PHP code that you can run each time the page is called...
put this at the VERY TOP of your web page and re-name it as .php extension.
Open in new window