📣Postfix(Text)Resp

Possible responses for the Postfix server

Once your Handle() method finished the pps Handler interfaces expects it to return a response code, so it can tell Postfix what to do with the mail in question. The PostfixResp and the PostifxTextResp types define all responses that Postfix accepts and the pps package supports.

Please check the Postfix documentation on the details of the various responses.

PostfixResp

The PostfixResp type defines all possible respones to Postfix that do not require any type additional text appended to it. Any of these can be directly used as return value in your Handle() method.

type PostfixResp string

const (
	RespOk            PostfixResp = "OK"
	RespReject        PostfixResp = "REJECT"
	RespDefer         PostfixResp = "DEFER"
	RespDeferIfReject PostfixResp = "DEFER_IF_REJECT"
	RespDeferIfPermit PostfixResp = "DEFER_IF_PERMIT"
	RespDiscard       PostfixResp = "DISCARD"
	RespDunno         PostfixResp = "DUNNO"
	RespHold          PostfixResp = "HOLD"
	RespInfo          PostfixResp = "INFO"
	RespWarn          PostfixResp = "WARN"
)

PostfixTextResp

The PostfixTextResp type defines those kind of responses that require to have additional information appended to it. These types cannot be directly used as return value in your Handle() function but need to be converted to a PostfixResp type first using the Custom responses functions.

type PostfixTextResp string

const (
	TextRespFilter   PostfixTextResp = "FILTER"
	TextRespPrepend  PostfixTextResp = "PREPEND"
	TextRespRedirect PostfixTextResp = "REDIRECT"
)

Custom responses

As already mentioned, the PostfixResp type responses do not require any additional information appended to, but most of those reponses allow it. For the PostfixTextResp types the additional information is non-optional. pps provides methods to create custom responses with both of these types.

TextResponseOpt

The TextResponseOpt() method allows you to append custom text to your PostfixResp type responses. It will return a valid PostfixResp type that can be used as return value in your Handle() method.

func TextResponseOpt(PostfixResp, string) PostfixResp

TextResponseNonOpt

With the TextResponseNonOpt() method you can make use of the PostfixTextResp type responses and create a valid PostfixResp type with it, that can be used as return value for your Handle() method.

func TextResponseNonOpt(PostfixTextResp, string) PostfixResp

Last updated