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

Send by e-mail link 2

Status
Not open for further replies.
Jun 9, 2004
188
US
I was wondering how people create the "e-mail article link" on webpages. I was hoping I could e-mail the current webpage link via e-mail using php. Would that be hard to do? What direct or tutorial does anyone suggest?

Thanks
 
what you need:

1) a html form (for input)
2) a mail script (php)

the html form then sends data to the mailscript, included the querystring!..

you also need some script to avoid double-posting (spamming), an email-validation script and a field for custom message.

I think it will take you 30-60 minutes, if you know a little bit of php. (with good result).

You can find examples of mailscript, email validation script, etc. on
then you should glue it together and test it for flaws.
 
I think I have a work around

<a href=\"mailto:?subject=Maharam%20Helpdesk%20Knowledge%20base%20Article&body=test\">

I know there is a command link self or something that will pass the current URL? Then I could pass the article id using an array function.
 
hmm.. I dont know.

but this way is client-dependent!
 
are you wanting to email a LINK to the current page, or email THE PAGE itself?

either way, to make sure the person doesn't have to have an email client (which will have to open up if you use that mailto: link), you should have the "Email this Article" link actually open up a PHP page with a form on it (as DaButcher suggested) where they put in an email address to send it to, and optional name, who it's from, etc. The Form would post back to itself, which has PHP script in it to do the mail'ing. That PHP script will use the PHP mail() function to have the Web Server send the email, rather than relying on the client to send it.

Then, you decide if that will email them just a simple email with the LINK in it, which the recipient can click, which is easily done by just putting the text of the fully qualified URL into the message body (
Or, if you want the whole article itself emailed to them, (text, pictures, etc), consider using ob_start() and it's associated functions... this turns on output buffering... so you can have the code which generates the page for the article, and capture that into a variable, and then send that whole value via email, which will give them an HTML email that looks like your webpage with the article on it.
 
Thanks guys. I figured it out.

I just wanted a link in the clients e-mail program This is an internal site which everyone uses outlook. Thanks.
 
sundance1980:
no problem, but if you have the time, I would recommend you to make a script like me and shadedecho talked about.

I think it will be a good thing to have as a resource for your future web developments.

You can also, as always, learn something new.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top