Recipe 17.18. Mail-Enabling a ContactProblemYou want to mail-enable a contact. SolutionUsing a graphical user interface
Using a command-line interface> exchmbx -b "<ContactDN>" -me <smtp email address> Replace <ContactDN> with the contact's distinguished name and the <smtp email address> with the contact's external email address. For an alternative method, create an LDIF file called mailenable_contact.ldf with the following contents: dn: CN=<ContactDN> changetype: modify replace: targetAddress targetaddress: SMTP:<smtp email address> - replace: mailNickName mailNickname: <mail nickname> - replace: mAPIRecipient mAPIRecipient: FALSE - replace: legacyExchangeDN legacyExchangeDN: <legacy exchange DN> - replace: internetEncoding legacyExchangeDN: 1310720 - Replace <ContactDN> with the contact's distinguished name, <smtp email address> with the contact's external email addresss, and <legacy exchange DN> with the proper legacy exchange distinguished name value. Then run the following command: >ldifde -i -f mailenable_user.ldf Using VBScript' This code mail enables a contact. ' ------ SCRIPT CONFIGURATION ------ strContactDN = "<ContactDN>" ' e.g., cn=jsmith,ou=Contacts,dc=rallencorp,dc=com strEmailAddr = "<EmailAddress>" 'e.g., jsmith234@freemail.net ' ------ END CONFIGURATION --------- set objContact = GetObject("LDAP://" & strContactDN) objContact.MailEnable strEmailAddr objContact.Put "internetEncoding",1310720 objContact.SetInfo( ) Wscript.Echo "Successfully mail-enabled contact." DiscussionA mail-enabled contact is a contact that has at least one email address defined within Exchange. A contact cannot have a mailbox because it is not a security principal, so there is no way to safely authenticate the object. You use a mail-enabled contact when you have an email address external to the forest's Exchange organization that you want to be listed in your GAL. The email address could be external to the company or it could just be external to that forest's Exchange organization. Examples would be people from other companies or users who do not use the Active Directory of the Exchange organization.
When you create a mail-enabled contact with the GUI or VBScript, you are using the CDOEXM interface library. The specific method called in this case is MailEnable. In the background, the specific changes made by the MailEnable method are on the contact object in Active Directory. They include changes to the following attributes:
In addition to those attributes, the internetEncoding attribute also needs to be set for proper message handling. See the Discussion in Recipe 17.9 for details. Once all of those attributes are in place, the RUS sets additional attributes on the contact object to make it usable for Exchange. Using a graphical user interfaceCreating a mail-enabled contact from scratch is very similar to mail-enabling an existing contact. Using a command-line interfaceSee the command-line discussion in Recipe 17.9 for details. Using VBScriptSee the VBScript discussion in Recipe 17.9 for details. See AlsoRecipe 17.10, and Recipe 17.19, and MS KB 275636 (Creating Exchange Mailbox-Enabled and Mail-Enabled Objects in Active Directory.) |