Solved

PHP Call to AD for Email Address

Posted on 2011-03-22
7
189 Views
Last Modified: 2012-05-11
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?
0
Comment
Question by:nrexpert
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 11

Accepted Solution

by:
Pieter Jordaan earned 500 total points
ID: 35189009
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
 

Author Comment

by:nrexpert
ID: 35189300
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
 
LVL 11

Assisted Solution

by:Pieter Jordaan
Pieter Jordaan earned 500 total points
ID: 35189366

No.
0
WordPress Tutorial 1: Installation & Setup

WordPress is a very popular option for running your web site and can be used to get your content online quickly for the world to see. This guide will walk you through installing the WordPress server software and the initial setup process.

 

Author Comment

by:nrexpert
ID: 35189744
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
 
LVL 11

Assisted Solution

by:Pieter Jordaan
Pieter Jordaan earned 500 total points
ID: 35189812

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
 

Author Comment

by:nrexpert
ID: 35189819
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
 
LVL 11

Assisted Solution

by:Pieter Jordaan
Pieter Jordaan earned 500 total points
ID: 35190125
Yes.

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

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

0

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question