CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
How do I get user's email adress?

 



steveperltk
New User

Dec 19, 2007, 7:46 AM

Post #1 of 3 (227 views)
How do I get user's email adress? Can't Post

Hi. I'm using sendmail in a Perl script to send an email to a specified address. I would like the user to also be copied on this email so that they recieve a copy of the email they sent using the program.

Can sendmail be configured to send an email to the user's own email address without asking the user for that address? What code do I need to use in order to determine the user's email address?

Thanks.
Steve.

****
Also, I'm using UNIX. So if sendmail can't determine a user's email address, does anyone know a way to do this?


(This post was edited by steveperltk on Dec 19, 2007, 10:55 AM)


KevinR
Veteran


Dec 19, 2007, 8:20 AM

Post #2 of 3 (226 views)
Re: [steveperltk] How do I get user's email adress? [In reply to] Can't Post

if the users email address is available to your script, you can use the cc or bcc header to send the user an email. But sendmail has no way of determining email addresses, you have to tell it what email addresses to use.
-------------------------------------------------


seltzer
Novice

Dec 19, 2007, 9:56 AM

Post #3 of 3 (223 views)
Re: [steveperltk] How do I get user's email adress? [In reply to] Can't Post

If we are talking about windows and the user is logged into Active Directory, this will work:

use Win32::OLE;
$info = Win32::OLE->new("ADSystemInfo");
$userdn=$info->{UserName};
$userObj=Win32::OLE->GetObject("LDAP://$userdn");
$email=$userObj->{mail};
print "$email\n";

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives