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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pull email address from db on mailto: link

Status
Not open for further replies.

SjrH

IS-IT--Management
Jun 24, 2003
747
GB
Is it possible to have an email address stored in mysql to be inserted into the To: field when a visitor clicks on a mailto: link? i.e php replaces the xxxx@xxx.xxx in
<a href="mailto:xxxx@xxx.xxx"> with the real email address from mysql?

Thanks
 
yes.

email addresses are just strings and you can retrieve and echo them to the screen like any other string

Code:
$email = "address@domain.com";
echo "<a href=\"mailto:$email\">Email</a>";
 
SjrH:
Are you trying to use mailto: links on a website without posting email addresses to that site? If so, you can't do that -- a mailto: link is handled by software on the client side without further interaction with your web server, so the address must be there.

This is different from obfuscating a URL on a site by having [ignore][/ignore] invisibly mapped to [ignore][/ignore], because the web browser must continue to interact with the web server. This puts the web server in a position to manipulate data without the knowledge of the browser. Otherwise it would be like trying obfuscate links to URLs that reside on browsers outside your control.



Want the best answers? Ask the best questions! TANSTAAFL!
 
If you do want to allow users to email people in your organization without exposing email addresses, you're going to have to provide a web form on your site which submits data to a mailing script on your site.

Just be careful to not use any user-supplied data as part of an address. You could end up with an open mail relay otherwise.



Want the best answers? Ask the best questions! TANSTAAFL!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top