PHP Call to AD for Email Address

I have a web form that submits to a PHP script to email the form's content.  I'd like the email to come from the logged in user's email address which is stored in Active Directory.  How do I call AD from the script and query for the logged in user's email address so that the script can use it to email from?
nrexpertAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
Pieter JordaanConnect With a Mentor Senior Systems Administrator - Web hosting and Network Security.Commented:
Hi

User login details are no longer available to web applications for security reasons.

The best you can do on a LAN, is to maintain a database of computer names with email addresses.

You can query the computer name on AD using the php ldap utilities.

The queries will differ depending on how the users and groups were created, but this page has many examples.

http://php.net/manual/en/function.ldap-search.php

I hope that helps.
0
 
nrexpertAuthor Commented:
This is for a LAN based application.  Is there a way to get the logged in user's name so that it can be used in the query to AD?
0
 
Pieter JordaanConnect With a Mentor Senior Systems Administrator - Web hosting and Network Security.Commented:

No.
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
nrexpertAuthor Commented:
Let me go about this differently.  I need a form that collects data from my end user and then submits to my help desk centralized email address.  The caveat here is that I need the email to come from the end user email address so my help desk system recognized who submitted the request.

How do I get that to work? Suggestions?
0
 
Pieter JordaanConnect With a Mentor Senior Systems Administrator - Web hosting and Network Security.Commented:

Can you imagine if that was possible?

Web sites could steal private information from computers everywhere.
You can not get that information from the server side.

The user has to enter it, and post it. The only information you can get, is in the Browser header, which will give you forwarding information, IP address etc.

So, you can use $_SERVER['REMOTE_ADDR'] to do a name lookup, and depending on the computer name vs login user, maybe you can use that.

Like I said, you will have to maintain a db with email address vs IP or hostname, and get the email address from there.
0
 
nrexpertAuthor Commented:
I don't mind asking my end user to put in their email address, if I do that, should I be able to use it to email from using smtp?
0
 
Pieter JordaanConnect With a Mentor Senior Systems Administrator - Web hosting and Network Security.Commented:
Yes.

You can use the php mail function to generate and deliver the email.

http://php.net/manual/en/function.mail.php

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.