ph_email_resolve(3)

NAME
ph_email_resolve, ph_advertised_email - determine PH-redirected email addresses

SYNOPSIS
#include <phclient.h>

int ph_email_resolve(PH *ph, char *user, char *fields, char **real_email);
int ph_advertised_email(PH *ph, char *alias, int confirm_alias, char **advertised_email);

VERSION
This man page documents version 1.2 of libphclient.

DESCRIPTION
The ph_email_resolve() function resolves the email address whose user portion is user. The real_email argument is set to point to a dynamically-allocated string containing the resolved email address. This memory must be later freed by the calling application. The fields argument is a string containing a space- or colon-delimited list of field names to match entries on. If fields is NULL or points to an empty string, ph_email_resolve() uses the field list specified by the server's mailmatches siteinfo field. If the server doesn't support the mailmatches field, ph_email_resolve() falls back to the default list, which is "alias:callsign". The ph_email_resolve() function returns the email address found in the field specified by the server's mailbox siteinfo field. This is typically set to email, which means that the email address will be found in the user's email field. The ph_advertised_email() function determines the advertised email address for the user whose alias is alias. If confirm_alias is set, the entry for alias is looked up to make sure it exists. The advertised_email argument is set to point to a dynamically-allocated string containing the advertised email address. This memory must later be freed by the calling application.

RETURN VALUE
These functions return 0 on success, PH_ERR_NOMATCH if a single matching entry cannot be found, and PH_ERR_DATAERR if the query is invalid. On error, they return -1 and set errno. In addition, ph_email_resolve() returns PH_ERR_DATAERR if a single matching entry is found but contains no email field.

ERRORS
These functions will fail with EINVAL if the server does not support the mailbox or mailfield siteinfo entries, or if they receive an unexpected response code from the server. In addition, they may fail with any error from the functions read() or write().

SEE ALSO
read(2), write(2), ph_open(3), ph_siteinfo(3)