Sun Java System Messaging Server 6 2005Q4 MTA Developer's Reference

mtaPostmasterAddress()

Obtain the MTA local postmaster address.

Syntax


const char *mtaPostmasterAddress(const char **address,
                                 size_t      *len,
                                 int          item code, ...)

Arguments

Arguments  

Description  

address

Optional pointer to receive the memory address of the string buffer containing the MTA local postmaster address. The string will be NULL terminated. A value of NULL may be passed for this argument. 

len

Optional address of a size_t to receive the length in bytes of the postmaster address. A value of NULL may be passed for this argument.

item code

Reserved for future use. A value of zero (0) must be passed for this argument.

Description

This routine returns a pointer to a NULL terminated string containing the MTA local postmaster address. This address is suitable, for instance, for inclusion in the From: header line of notification messages as shown in the code example for this routine.

It is usually not a good idea for programs to send mail to the postmaster’s address. In many situations, sending mail to the postmaster when failures occur can lead to mail loops if the mail sent to the postmaster itself fails, and generates a message to the postmaster, which then fails, and generates yet another message to the postmaster, and so on.

On a successful completion, the address of the string buffer containing the postmaster’s address is returned using the address call argument. That same address is also returned as the return status.

Return Values

In the event of an error, a value of NULL is returned as the status and mta_errno is set with a status code indicating the underlying error.

Error Status Codes  

Description  

MTA_FOPEN

Unable to initialize the MTA SDK. Unable to read one or more configuration files. For further information, issue the following command: 

imsimta test -rewrite

MTA_NO

Unable to initialize the MTA SDK. For further information, issue the following command: 

imsimta test -rewrite

Example

The following example shows how to use this routine to include the postmaster address in the From: header line of a notification message:


mtaEnqueueWriteLine(nq, "From: Postmaster <", 0,
                    mtaPostmasterAddress(NULL, NULL, 0), 0,
                    "\>", 0, NULL);