Next: , Previous: , Up: Context Attributes   [Contents][Index]

7.4.3 How to tell the engine the sender.

Some engines can make use of the sender’s address, for example to figure out the best user id in certain trust models. For verification and signing of mails, it is thus suggested to let the engine know the sender ("From:") address. GPGME provides two functions to accomplish that. Note that the esoteric use of multiple "From:" addresses is not supported.

Function: gpgme_error_t gpgme_set_sender (gpgme_ctx_t ctx, int address)

SINCE: 1.8.0

The function gpgme_set_sender specifies the sender address for use in sign and verify operations. address is expected to be the “addr-spec” part of an address but may also be a complete mailbox address, in which case this function extracts the “addr-spec” from it. Using NULL for address clears the sender address.

The function returns 0 on success or an error code on failure. The most likely failure is that no valid “addr-spec” was found in address.

Function: const char * gpgme_get_sender (gpgme_ctx_t ctx)

SINCE: 1.8.0

The function gpgme_get_sender returns the current sender address from the context, or NULL if none was set. The returned value is valid as long as the ctx is valid and gpgme_set_sender has not been called again.