For Programmers: Free Programming Magazines  


Home > Archive > LDAP > February 2007 > Add SMTP address to proxyAddresses in AD









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Add SMTP address to proxyAddresses in AD
Giuoco, Aaron

2007-02-16, 7:16 pm

Hi LDAP list,

I seem to be having a problem adding SMTP addresses to the
proxyAddresses attribute. We are using Windows 2003 domain controllers
and have a Windows 2003 server running Exchange 2003 as our mail server.

Below is function I have written for adding and SMTP address to an AD
account.



sub enterNewEmail {
my $ldapConn =3D shift;
my $entry =3D shift;
my $newEmail =3D shift;

if ($entry and $newEmail) {
my $message =3D $ldapConn->modify($entry->dn(), add =3D> {
'proxyAddresses' =3D> "smtp:" . $newEmail });
if ($message->code =3D=3D 0) {
return 1;
} else {
print "Error adding email address $newEmail: " .
$message->error() . "\n";
return undef;
}
} else {
return undef;
}
}



The odd thing is that this function never returns errors (it always
returns 1). But when I look in AD at my test account, the email address
wasn't added to the proxyAddresses attribute. Any ideas why this
doesn't work?

___________________________
Aaron Giuoco
Systems Admin
Atlantia Offshore Limited
e: agiuoco@atlantia.com
ph: 281-899-4385
Chris Ridd

2007-02-17, 4:18 am

On 16/2/07 4:50, "Giuoco, Aaron" <AGiuoco@atlantia.com> wrote:

> Hi LDAP list,
>
> I seem to be having a problem adding SMTP addresses to the
> proxyAddresses attribute. We are using Windows 2003 domain controllers
> and have a Windows 2003 server running Exchange 2003 as our mail server.
>
> Below is function I have written for adding and SMTP address to an AD
> account.
>
>
>
> sub enterNewEmail {
> my $ldapConn = shift;
> my $entry = shift;
> my $newEmail = shift;
>
> if ($entry and $newEmail) {
> my $message = $ldapConn->modify($entry->dn(), add => {
> 'proxyAddresses' => "smtp:" . $newEmail });
> if ($message->code == 0) {
> return 1;
> } else {
> print "Error adding email address $newEmail: " .
> $message->error() . "\n";
> return undef;
> }
> } else {
> return undef;
> }
> }
>
>
>
> The odd thing is that this function never returns errors (it always
> returns 1).


You might be better off asking on an AD-specific list, since AD is not
/really/ an LDAP server.

Cheers,

Chris


Giuoco, Aaron

2007-02-20, 4:16 am

Understood. I did figure out a different way to do it.

Rather than try to use ADD to append to the list, I just dumped the
proxyAddresses list into an array, added my new email address to the
array, then pushed the entire array back into the proxyAddresses
property using REPLACE. That worked for some reason.

AG

> -----Original Message-----
> From: Chris Ridd [mailto:chrisridd@mac.com]=20
> Sent: Saturday, February 17, 2007 1:00 AM
> To: Giuoco, Aaron; perl-ldap@perl.org
> Subject: Re: Add SMTP address to proxyAddresses in AD
>=20
> On 16/2/07 4:50, "Giuoco, Aaron" <AGiuoco@atlantia.com> wrote:
>=20
> 2003 as our mail server.
> address to an AD=20
> ($message->code =3D=3D 0) {=20
>=20
> You might be better off asking on an AD-specific list, since=20
> AD is not /really/ an LDAP server.
>=20
> Cheers,
>=20
> Chris
>=20
>=20
>=20


----------------------------------------------------=0D
This message and any attachment are confidential and may be privileged or o=
therwise protected from disclosure. If you are not the intended recipient,=
please telephone or Email the sender and delete this message and any attac=
hment from your system. If you are not the intended recipient you must not=
copy this message or attachment or disclose the contents to any other pers=
on.
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com