Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sending an email

Status
Not open for further replies.

PNorman

Programmer
Feb 7, 2005
30
US
I want the user to be able to enter their email address, name, and message in a form and after submitting it the next page gathers my email address from the db and sends me an email. The following form works but it would display my email address which I don't want.

Code:
<html>
<body>
<form action="MAILTO:me@myeamailaddress.com" method="post" enctype="text/plain">

Name:<br>
<input type="text" name="name"
value="your name" size="20">
<br>
Mail:<br>
<input type="text" name="mail"
value="your email" size="20">
<br>
Comment:<br>
<input type="text" name="comment"
value="message" size="40">
<br><br>
<input type="submit" value="Send">
<input type="reset" value="Reset">

</form>
</body>
</html>

I took out the action statement and made the page post to another page where....if all fields are filled I'd like for everything to be sent to me. Is there an easy way to do this? I've looked at other messages on this forum and I can't find anything I believe I need.

Thanks
 
you can do something like this:

<form action="somepage.asp" method="post" enctype="text/plain">

and you can have a hidden form field with your email address and then process everything on somepage.asp which will send email to your address...

<input type="hidden" name="myemail"
value="me@myeamailaddress.com" size="20">


-DNG
 
Thanks for the reply...

That's a good idea but how would I automatically send it from "somepage.asp"?

Thanks again!
 
You need an email program like JMail installed on your server.

Note: if you put your email address in a hidden field it will still be visible to anyone who does a view source on the page. Since you're pulling it out of a database, don't pull it out until you actually need it, on the "somepage.asp".

Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
thanks for the reply....

Are you saying I have to mail it from the web server? Not from the user?

There's no way I can do it similarly to the form example I have?

Thanks again
 
Not if you don't want people to be able to see your email address. If you're sending client-side you're going to have to send your email address to the page somehow, and that will make it visible to the user.


Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
Yes I know I'll have to send my address to the page, however, I am planning on doing it on another page and sending the user back to another. Similar to how a user would log into a site and after being verified they are directed to another page. Is anything like this possible for sending an email? If so please share with me how it's done.

thanks
 
Sorry I'm fairly new....what's chr(13)&chr(10) got to do with sending emails? Can you please give an example?

thanks
 
sorry...i dint mean to post that in this thread...wrong thread...

-DNG
 
Generally you're still not going to be able to get things to work the way you want without submitting the mail from the server. Usually (maybe always) when you send an email from the client, via a mailto link or whatever, the browser pops up the users default email program to send it. I don't think you can stop that from happening. If you send the info to a server-side page and send the mail from there, that won't happen.

Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top