Package opensmtpd implements OpenSMTPD-extras in Go https://godoc.org/pkg/maze.io/x/opensmtpd
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

table_test.go 447B

1234567891011121314151617181920212223
  1. package opensmtpd
  2. func ExampleTable() {
  3. // In smtpd.conf:
  4. //
  5. // table aliases <name-of-filter>:
  6. // accept for local alias <aliases> ...
  7. aliases := map[string]string{
  8. "root": "user@example.org",
  9. }
  10. table := &Table{
  11. Lookup: func(service int, params Dict, key string) (string, error) {
  12. // We are only valid for aliases
  13. if service&ServiceAlias != 0 {
  14. return aliases[key], nil
  15. }
  16. return "", nil
  17. },
  18. }
  19. table.Serve()
  20. }