]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: mail-user: Add convenience functions for obtaining postmaster address.
authorStephan Bosch <stephan.bosch@dovecot.fi>
Wed, 5 Sep 2018 19:23:05 +0000 (21:23 +0200)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Wed, 14 Nov 2018 12:26:50 +0000 (14:26 +0200)
src/lib-lda/mail-send.c
src/lib-storage/mail-user.h

index 6de9f2e006036b39b11a7df6efa0fe62f8d62519..05d5d8220030dbb5ef0628ddc5e534c5728f9a7a 100644 (file)
@@ -82,8 +82,7 @@ int mail_send_rejection(struct mail_deliver_context *ctx,
                return 0;
        }
 
-       if (!mail_user_set_get_postmaster_address(user->set, &postmaster_addr,
-                                                 &error)) {
+       if (!mail_user_get_postmaster_address(user, &postmaster_addr, &error)) {
                i_error("msgid=%s: Invalid postmaster_address - can't send rejection: %s",
                        orig_msgid == NULL ? "" : str_sanitize(orig_msgid, 80), error);
                return -1;
index 1627e34fe1843ee545db3ba06426ba9d30e8d568..a670f0f14db01c69acdef2298d14bbc541e8f158 100644 (file)
@@ -215,4 +215,28 @@ void mail_user_stats_fill(struct mail_user *user, struct stats *stats);
    with ENOENT. This way it avoids unnecessary disk IO to the home. */
 int mail_user_home_mkdir(struct mail_user *user);
 
+/* Obtain the postmaster address to be used for this user as an RFC 5322 (IMF)
+   address. Returns false if the configured postmaster address is invalid in
+   which case error_r contains the error message. */
+static inline bool
+mail_user_get_postmaster_address(struct mail_user *user,
+                                const struct message_address **address_r,
+                                const char **error_r)
+{
+       return mail_user_set_get_postmaster_address(user->set, address_r,
+                                                   error_r);
+}
+
+/* Obtain the postmaster address to be used for this user as an RFC 5321 (SMTP)
+   address. Returns false if the configured postmaster address is invalid in
+   which case error_r contains the error message. */
+static inline bool
+mail_user_get_postmaster_smtp(struct mail_user *user,
+                             const struct smtp_address **address_r,
+                             const char **error_r)
+{
+       return mail_user_set_get_postmaster_smtp(user->set, address_r,
+                                                error_r);
+}
+
 #endif