Skip to main content
Participating Frequently
October 7, 2012
Answered

Email with php and mysql

  • October 7, 2012
  • 1 reply
  • 1303 views

I want a visitor to my site to click on a mysql field to send an email with a Bcc to myself also I want the link to show "Send an email" not the email address from the field

This topic has been closed for replies.
Correct answer David_Powers

Many thanks for the reply and solution with regard to your comments about this not being the best way to go about it

would putting the Bcc address into a variable or constant hide it and how would be the best way to handle the other problem

Have just ordered PHP Soulutions do you reccomend any other books for someone just starting PHP and Mysql and Databases

Cheers


There is no way to hide a BCC address with a mailto link because it simply opens the user's mail program with the address fields filled in.

What I would recommend is creating a contact form as described in Chapter 5 of PHP Solutions. Using PHP to send the form hides both your email address and any BCC addresses. It sounds from your description that the email will be sent to different people depending on which link is clicked. If that's the case, the programming becomes more complex, but you can tackle that problem once you have learned how to create a contact form and send email with PHP.

I would hope that PHP Solutions is sufficient for your needs, but I warn you to take Chapter 3 slowly. Don't attempt to memorize everything in Chapter 3. Just get a general feel for how the language is structured, and come back to the chapter any time you need to refresh your memory. If you do feel the need for another book, I believe that Larry Ullman's Visual Quick Start books are good.

1 reply

Nancy OShea
Community Expert
Community Expert
October 7, 2012

You need a contact form page with a form-to-email processing script. Preferably one which conceals your e-mail address from harvesters and has built-in spam prevention.  This one can handle BCCs as well as CCs.

Formm@ailer PHP from DB Masters

http://dbmasters.net/index.php?id=4

Nancy O.

Nancy O'Shea— Product User & Community Expert
Participating Frequently
October 8, 2012

First sorry for posting twice thought first post was in the wrong forum should have deleted it new at this

second maybe not explained correcly I have a master page and a detail page I want a result n the detail page table to be a mailto link with a bcc also the detail page result to show send an email

David_Powers
Inspiring
October 8, 2012

OK, I have now moved the thread to the server-side applications forum.

Using a mailto link isn't normally recommended, because it depends on the user's mail program. If the user is on a shared machine or a public one, such as in an internet cafe, it won't work. Another problem is that the bcc address will be exposed to the sender when the mail program opens.

Nevertheless, if that's what you want, this is how you do it. You'll need to edit the HTML and PHP code in Code view.

The email address will currently be displayed using PHP like this (the actual code depends on the names of the recordset and email field):

<?php echo $row_recordsetName['email']; ?>

To convert that to a mailto link with bcc, you need to change the code like this:

<a href="mailto:<?php echo $row_recordsetName['email']; ?>?bcc=not-so-secret@example.com">Send an email</a>