https://t.me/RX1948
Server : Apache
System : Linux server.lienzindia.com 4.18.0-348.7.1.el8_5.x86_64 #1 SMP Wed Dec 22 13:25:12 UTC 2021 x86_64
User : plutus ( 1007)
PHP Version : 7.4.33
Disable Function : NONE
Directory :  /etc/exim/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //etc/exim/exim.conf
# DO NOT EDIT webuzo autogenerated file

######################################################################
#                 Exim variables 
######################################################################

hostlist loopback = <; @[]; 127.0.0.0/8 ; 0.0.0.0 ; localhost ; ::1 ; 0000:0000:0000:0000:0000:ffff:7f00:0000/8

hostlist senderverifybypass_hosts = net-iplsearch;/etc/senderverifybypasshosts

hostlist skipsmtpcheck_hosts = net-iplsearch;/etc/skipsmtpcheckhosts

hostlist spammeripblocks = net-iplsearch;/etc/spammeripblocks

hostlist blocked_incoming_email_country_ips = ${if exists{/etc/blocked_incoming_email_country_ips} {net-iplsearch;/etc/blocked_incoming_email_country_ips} {} }

hostlist backupmx_hosts = lsearch;/etc/backupmxhosts

hostlist trustedmailhosts = lsearch;/etc/trustedmailhosts

hostlist recent_authed_mail_ips = net-iplsearch;/etc/recent_authed_mail_ips

hostlist neighbor_netblocks = net-iplsearch;/etc/neighbor_netblocks

hostlist greylist_trusted_netblocks = net-iplsearch;/etc/greylist_trusted_netblocks

hostlist greylist_common_mail_providers = net-iplsearch;/etc/greylist_common_mail_providers

hostlist recent_recipient_mail_server_ips = net-iplsearch;/etc/recent_recipient_mail_server_ips

domainlist local_domains = lsearch;/etc/localdomains

domainlist user_domains = ${if exists{/etc/userdomains} {lsearch;/etc/userdomains} fail}

domainlist secondarymx_domains = lsearch;/etc/secondarymx

domainlist relay_domains = +local_domains : +secondarymx_domains

domainlist blocked_domains = wildlsearch;/etc/blocked_incoming_email_domains

domainlist manualmx_domains = ${if exists {/etc/manualmx} {lsearch;/etc/manualmx} {} }

localpartlist path_safe_localparts = \N^\.*[^./][^/]*$\N

smtp_accept_queue_per_connection = 30

remote_max_parallel = 10

smtp_receive_timeout = 165s

ignore_bounce_errors_after = 1d

rfc1413_query_timeout = 0s

timeout_frozen_after = 5d

auto_thaw = 7d

callout_domain_negative_expire = 1h

callout_negative_expire = 1h

acl_not_smtp = acl_not_smtp

acl_smtp_connect = acl_smtp_connect

acl_smtp_data = acl_smtp_data

acl_smtp_helo = acl_smtp_helo

acl_smtp_mail = acl_smtp_mail

acl_smtp_quit = acl_smtp_quit

acl_smtp_notquit = acl_smtp_notquit

acl_smtp_rcpt = acl_smtp_rcpt

acl_smtp_dkim = acl_smtp_dkim

USER_ON_BLACKLIST=User account is not allowed to send/recieve emails. User is suspended.

message_body_newlines = true

check_rfc2047_length = false

keep_environment = X-SOURCE : X-SOURCE-ARGS : X-SOURCE-DIR

add_environment = PATH=/usr/local/sbin::/usr/local/bin::/sbin::/bin::/usr/sbin::/usr/bin::/sbin::/bin

chunking_advertise_hosts = 198.51.100.1

deliver_queue_load_max = 12

queue_only_load = 24

daemon_smtp_ports = 25 : 465 : 587

tls_on_connect_ports = 465

openssl_options = +no_sslv2 +no_sslv3 +no_tlsv1 +no_tlsv1_1

tls_require_ciphers =  ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384

spamd_address = 127.0.0.1 783 retry=30s tmo=3m

BADCHARS = \N[^A-Za-z0-9_.-]+\N
SAFELOCALPART = ${lookup{${sg{$local_part}{BADCHARS}{_}}} lsearch*,ret=key{/etc/userdomains}}
SAFEDOMAIN = ${lookup{${sg{$domain}{BADCHARS}{_}}} lsearch*,ret=key{/etc/userdomains}}

tls_certificate = ${if and \
    { \
        {gt{$tls_in_sni}{}} \
        {!match{$tls_in_sni}{/}} \
    } \
    {${if exists {/var/webuzo-data/certs/$tls_in_sni.pem} \
        {/var/webuzo-data/certs/$tls_in_sni.pem} \
        {${if exists {${sg{/var/webuzo-data/certs/$tls_in_sni.pem}{(.+/)[^.]+\.(.+\.pem)}{\$1\$2}}} \
            {${sg{/var/webuzo-data/certs/$tls_in_sni.pem}{(.+/)[^.]+\.(.+\.pem)}{\$1\$2}}} \
            {/etc/exim/webuzo.crt} \
        }}  \
    }} \
    {/etc/exim/webuzo.crt} \
}


tls_privatekey = ${if and \
    { \
        {gt{$tls_in_sni}{}} \
        {!match{$tls_in_sni}{/}} \
    } \
    {${if exists {/var/webuzo-data/certs/$tls_in_sni.pem} \
        {/var/webuzo-data/certs/$tls_in_sni.pem} \
        {${if exists {${sg{/var/webuzo-data/certs/$tls_in_sni.pem}{(.+/)[^.]+\.(.+\.pem)}{\$1\$2}}} \
            {${sg{/var/webuzo-data/certs/$tls_in_sni.pem}{(.+/)[^.]+\.(.+\.pem)}{\$1\$2}}} \
            {/etc/exim/webuzo.key} \
        }} \
    }} \
    {/etc/exim/webuzo.key} \
}

log_selector = +subject +arguments +received_recipients

system_filter = /etc/exim/exim_system_filter


addresslist secondarymx = *@partial-lsearch;/etc/secondarymx

######################################################################
#                    MAIN CONFIGURATION SETTINGS                     #
######################################################################

perl_startup = do '/etc/exim/exim.pl'

smtp_banner = "${primary_hostname} ESMTP Exim ${version_number} \
\#${compile_number} ${tod_full} \n\
    We do not authorize the use of this system to transport unsolicited, \n\
    and/or bulk e-mail."


#nobody as the sender seems to annoy people
untrusted_set_sender = *
local_from_check = false

split_spool_directory = yes

smtp_connect_backlog = 50

smtp_accept_max = 500

message_body_visible = 5000

never_users = root

tls_advertise_hosts = *

helo_accept_junk_hosts = *

smtp_enforce_sync = false


######################################################################
#                 DO NOT EDIT Exim Webuzo Acl 
######################################################################

begin acl

acl_not_smtp:

	accept
acl_not_smtp_mime:
	
	accept
acl_not_smtp_start:
	
	accept
acl_smtp_auth:
	
	accept
acl_smtp_connect:

drop
    message = Your country is not allowed to connect to this server.
    log_message = Country is banned
    hosts = +blocked_incoming_email_country_ips
#ratelimit
accept
	hosts = : +loopback : +recent_authed_mail_ips : +backupmx_hosts

accept
	hosts = +trustedmailhosts

accept
	condition = ${if match_ip{$sender_host_address}{net-iplsearch;/etc/trustedmailhosts}{1}{0}}

defer
	#only rate limit port 25
	condition = ${if eq {$received_port}{25}{yes}{no}}
	message = The server has reached its limit for processing requests from your host.  Please try again later.
	log_message = "Host is ratelimited ($sender_rate/$sender_rate_period max:$sender_rate_limit)"
	ratelimit = 1.2 / 1h / strict / per_conn / noupdate


drop
    message = Your host is not allowed to connect to this server.
    log_message = Host is banned
    !hosts = : +skipsmtpcheck_hosts : +trustedmailhosts
    hosts = +spammeripblocks

accept

acl_smtp_data:

accept  hosts = : +loopback : +recent_authed_mail_ips : +backupmx_hosts

accept
		authenticated = *
		hosts = *

accept
		condition = ${extract{size}{${stat:/etc/trustedmailhosts}}}
		hosts = +trustedmailhosts

accept
		condition = ${extract{size}{${stat:/etc/trustedmailhosts}}}
		condition = ${if match_ip{$sender_host_address}{net-iplsearch;/etc/trustedmailhosts}{1}{0}}
		
warn
	# Remove spam headers from outside sources
	condition = ${perl{spamd_is_available}}
	!hosts = +skipsmtpcheck_hosts
	remove_header  = x-spam-subject : x-spam-status : x-spam-score : x-spam-bar : x-spam-report : x-spam-flag : x-ham-report


warn
	condition = ${perl{spamd_is_available}}
	condition = ${if eq {${acl_m0}}{1}{1}{0}}
	spam =  ${acl_m1}/defer_ok
	!hosts = : +trustedmailhosts
	log_message = "SpamAssassin as ${acl_m1} detected message as spam ($spam_score)"
	add_header = X-Spam-Subject: ***SPAM*** $rh_subject
	add_header = X-Spam-Status: Yes, score=$spam_score
	add_header = X-Spam-Score: $spam_score_int
	add_header = X-Spam-Bar: $spam_bar
	add_header = X-Spam-Report: ${sg{$spam_report}{\N\n \n\N}{\n}}
	add_header = X-Spam-Flag: YES
	set acl_m2 = 1

warn
	condition = ${perl{spamd_is_available}}
	condition =  ${if eq {$spam_score_int}{}{0}{${if <= {${spam_score_int}}{8000}{${if >= {${spam_score_int}}{50}{${perl{store_spam}{$sender_host_address}{$spam_score}}}{0}}}{0}}}}

warn
	condition = ${perl{spamd_is_available}}
	condition = ${if eq {${acl_m0}}{1}{${if eq {${acl_m2}}{1}{0}{1}}}{0}}
	add_header = X-Spam-Status: No, score=$spam_score
	add_header = X-Spam-Score: $spam_score_int
	add_header = X-Spam-Bar: $spam_bar
	add_header = X-Ham-Report: ${sg{$spam_report}{\N\n \n\N}{\n}}
	add_header = X-Spam-Flag: NO
	log_message = "SpamAssassin as ${acl_m1} detected message as NOT spam ($spam_score)"


drop
	message = This message is denied by policy : $spam_score spam points
	log_message = This message is denied by policy : $spam_score spam points 
	condition = ${if <= {5}{${lookup{${acl_m1}}lsearch{/etc/spamscore}{$value}}}{1}{0}}
	condition = ${if > {$spam_score_int}{${lookup{${acl_m1}}lsearch{/etc/spamscore}{$value}}}{1}{0}}

accept

acl_smtp_etrn:

accept
acl_smtp_helo:

accept

acl_smtp_mail:

#hold outgoing mail
accept
	condition = ${lookup{$sender_address}lsearch{/etc/hold_outgoing_users}{1}{0}}
	control   = freeze/no_tell

# ignore authenticated hosts
accept
	authenticated = *

#warn
#	condition = ${if match_ip{$sender_host_address}{+loopback}{${perl{identify_local_connection}{$sender_host_address}{$sender_host_port}{$received_ip_address}{$received_port}{1}}}{0}}
#	set acl_c_authenticated_local_user = ${perl{get_identified_local_connection_user}}

accept
	hosts = : +loopback : +recent_authed_mail_ips : +backupmx_hosts
	
#requirehelo
deny
    condition = ${if eq{$sender_helo_name}{}}
    message   = HELO required before MAIL
#requirehelosyntax
drop
    condition   = ${if isip{$sender_helo_name}}
    message     = Access denied - Invalid HELO name (See RFC2821 4.1.3)

drop
    # Required because "[IPv6:<address>]" will have no .s
    condition   = ${if match{$sender_helo_name}{\N^\[\N}{no}{yes}}
    condition   = ${if match{$sender_helo_name}{\N\.\N}{no}{yes}}
    message     = Access denied - Invalid HELO name (See RFC2821 4.1.1.1)

drop
    condition   = ${if match{$sender_helo_name}{\N\.$\N}}
    message     = Access denied - Invalid HELO name (See RFC2821 4.1.1.1)

drop
    condition   = ${if match{$sender_helo_name}{\N\.\.\N}}
    message     = Access denied - Invalid HELO name (See RFC2821 4.1.1.1)

   
accept

acl_smtp_mailauth:
	
	accept
acl_smtp_mime:
deny 
	message = Blacklisted file extension detected
    condition = ${if match \
					{${lc:$mime_filename}} \
					{\N(\.exe|\.pif|\.bat|\.scr|\.lnk|\.com)$\N} \
				 {1}{0}}
	accept
acl_smtp_notquit:
#ratelimit
# ignore authenticated hosts
accept authenticated = *

accept hosts = : +recent_authed_mail_ips : +loopback : +backupmx_hosts

warn
    #only rate limit port 25
    condition = ${if eq {$received_port}{25}{yes}{no}}
    condition = ${if match {$smtp_notquit_reason}{command}{yes}{no}}
    log_message = "Connection Ratelimit - $sender_fullhost because of notquit: $smtp_notquit_reason ($sender_rate/$sender_rate_period max:$sender_rate_limit)"
    ratelimit = 1.2 / 1h / strict / per_conn

accept

acl_smtp_predata:

accept
acl_smtp_quit:

	accept
	
acl_smtp_rcpt:

# implemented for "suspend incoming/outgoing email" feature for user
deny
	condition   = ${lookup{${lookup{$sender_address_domain}lsearch{/etc/userdomains}{$value}}}lsearch{/etc/user_suspended_list}{1}{0}}
	message     = USER_ON_BLACKLIST
	log_message = USER_ON_BLACKLIST

deny
	condition   = ${lookup{${lookup{$domain}lsearch{/etc/userdomains}{$value}}}lsearch{/etc/user_suspended_list}{1}{0}}
	message     = USER_ON_BLACKLIST
	log_message = USER_ON_BLACKLIST


# deny suspend_outgoing_users
deny
	message = The $sender_address is suspended to send an outgoing mail. Please contact admin to unsuspend
	log_message = The $sender_address is suspended to send an outgoing mail. Please contact admin to unsuspend
	senders = lsearch;/etc/suspend_outgoing_users

# deny suspend_incoming_users
deny
	message = The $local_part@$domain is suspended to receive any incoming mail.
	log_message = The $local_part@$domain is suspended to receive any incoming mail.
	condition   = ${if exists {/etc/exim/users/${lookup{$domain}lsearch{/etc/userdomains}{$value}}/.${sg{$local_part}{\N[/+].*\N}{}}@${domain}.suspended_incoming}}


warn
	!domains = +relay_domains
	set acl_m_outbound_recipient = 1
	
#dkim_disable
warn
	control = dkim_disable_verify

accept
	authenticated = *
	condition = ${if eq{${lookup{$sender_address_domain}lsearch{/etc/userdomains}}}{$sender_address_local_part}}
	endpass
	verify = recipient

accept
	authenticated = *
	endpass
	verify = recipient

# if they used "pop before smtp" then we just accept
accept
	condition = ${if exists{/etc/popbeforesmtp}{1}{0}}
	condition = ${if exists{/var/webuzo-data/popb4smtp/${substr_-1_1:$sender_host_address}/$sender_host_address}}
	hosts = ! +loopback
	endpass
	verify = recipient

# BEGIN RBL

# END of RBL
deny
	message = Your host is not allowed to connect to this server.
	log_message = Sender domain is banned
	sender_domains = !+local_domains : +blocked_domains

deny
	message = Mailbox is full / Blocks limit exceeded / Inode limit exceeded
	log_message = Mailbox is full / Blocks limit exceeded / Inode limit exceeded
	condition = ${if match {${readsocket{/var/run/dovecot/quota-status}{request=smtpd_access_policy\nrecipient=${quote:$local_part}@${quote:$domain}\nsize=$message_size\n\n}{30s}{\n}{SOCKETFAIL}}}{action=5}{true}{false}}
	
accept
	hosts = :
	endpass
	verify = recipient

accept
	condition = ${extract{size}{${stat:/etc/skipsmtpcheckhosts}}}
	hosts     = +skipsmtpcheck_hosts
	endpass
	verify = recipient

# implemented for "suspend incoming email" feature
deny
	domains     = !$primary_hostname : +local_domains
	condition   = ${if exists {${extract{5}{:}{${lookup passwd{${lookup{$domain}lsearch{/etc/userdomains}}}}}{$value}}/etc/.${sg{$local_part}{\N[/+].*\N}{}}@${domain}.suspended_incoming}}
	message     = 525 5.7.13 Disabled recipient address
	log_message = Mail to ${local_part}@${domain} has been suspended

# implemented for "suspend outgoing email" feature for domains and individual webmail/pop accounts (to do)
#deny
#	domains     = ! +local_domains
#	condition   = ${perl{check_outgoing_mail_suspended}}
#	message     = ${perl{get_outgoing_mail_suspended_message}}
#	log_message = ${perl{get_outgoing_mail_suspended_message}}

# if they used "pop before smtp" and its not bound for a localdomain we remember the recent_authed_mail_ips_domain
warn
	domains = ! +local_domains
	hosts = ! +loopback
	hosts = +recent_authed_mail_ips
	set acl_c_recent_authed_mail_ips_text_entry = ${perl{get_recent_authed_mail_ips_text_entry}{1}}
	add_header = ${if exists{/etc/eximpopbeforesmtpwarning}{${perl{popbeforesmtpwarn}{$sender_host_address}}}{}}

# we need to check alwaysrelay since we don't require recentauthedmailiptracker to be enabled
accept
	hosts = ! +loopback
	condition = ${if or {{eq{$acl_c_recent_authed_mail_ips_text_entry}{}}{!exists{/etc/popbeforesmtp}}}{${if exists {/etc/alwaysrelay}{${lookup{$sender_host_address}iplsearch{/etc/alwaysrelay}{1}{0}}}{0}}}{0}}
	set acl_c_recent_authed_mail_ips_text_entry = ${perl{get_recent_authed_mail_ips_text_entry}{1}}
	set acl_c_alwaysrelay = 1
	endpass
	verify = recipient

# Reject unauthenticated relay on port 587
drop
	condition = ${if eq{$received_port}{587}{1}{0}}
	message = SMTP AUTH is required for message submission on port 587

require
	verify = recipient

# skip content scanning for suspended recipients that are being queued, blackholed or relayed
accept
	condition = ${extract{suspended}{$address_data}}
#dictionary_attack
warn
	log_message = "Detected Dictionary Attack (Let $rcpt_fail_count bad recipients though before engaging)"
	condition = ${if > {${eval:$rcpt_fail_count}}{4}{yes}{no}}
	set acl_m7 = 1

warn
	condition = ${if eq {${acl_m7}}{1}{1}{0}}
	ratelimit = 0 / 1h / strict / per_conn
	log_message = "Increment Connection Ratelimit - $sender_fullhost because of Dictionary Attack"

drop
	condition = ${if eq {${acl_m7}}{1}{1}{0}}
	message = "Number of failed recipients exceeded.  Come back in a few hours."

warn
	domains    = +local_domains
	condition  = ${if <= {$message_size}{1000K}}
	condition  = ${if !eq{${acl_m0}}{1}}
	condition  = ${if exists{/etc/global_spamassassin_enable}{1}{${if exists{${extract{5}{::}{${lookup passwd{${if eq{$domain}{$primary_hostname}{${sg{$local_part}{\N[/+].*\N}{}}}{${lookup{$domain}lsearch{/etc/userdomains}}}}}}}}/.spamassassindisable}{0}{1}}}}
	set acl_m0 = 1
	set acl_m1 = ${if eq{$domain}{$primary_hostname}{${sg{$local_part_data}{\N[/+].*\N}{}}}{${lookup{$domain}lsearch{/etc/userdomains}}}}
#spam_scan_secondarymx
warn  domains = ! +local_domains : +secondarymx_domains
	condition = ${if <= {$message_size}{1000K}{1}{0}}
	set acl_m0    = 1
	set acl_m1    = exim

accept  domains = +relay_domains

deny    message = ${expand:${lookup{host_accept_relay}lsearch{/etc/eximrejects}{$value}}}
	  log_message = Rejected relay attempt: '$sender_host_address' From: '$sender_address' To: '$local_part@$domain'

	accept
acl_smtp_starttls:
	
	accept
acl_smtp_vrfy:
	
	accept
acl_smtp_dkim:

	accept
######################################################################
#                 DO NOT EDIT Exim Webuzo Aunthenticators
######################################################################

begin authenticators


dovecot_plain:
    driver = dovecot
    public_name = PLAIN
    server_socket = /var/run/dovecot/auth-client
    server_set_id = $auth1
    server_condition = ${if and {{!match {$auth1}{\N[/]\N}}{eq{${if match {$auth1}{\N[+%:@]\N}{${lookup{${extract{2}{+%:@}{$auth1}}}lsearch{/etc/demodomains}{yes}}}{${lookup{$auth1}lsearch{/etc/demousers}{yes}}}}}{}}}{true}{false}}

	server_advertise_condition = ${if or {{def:tls_cipher}{match_ip{$sender_host_address}{+loopback}}}{1}{0}}

dovecot_login:
	driver = dovecot
	public_name = LOGIN
	server_socket = /var/run/dovecot/auth-client
	server_set_id = $auth1
	server_condition = ${if and {{!match {$auth1}{\N[/]\N}}{eq{${if match {$auth1}{\N[+%:@]\N}{${lookup{${extract{2}{+%:@}{$auth1}}}lsearch{/etc/demodomains}{yes}}}{${lookup{$auth1}lsearch{/etc/demousers}{yes}}}}}{}}}{true}{false}}

	server_advertise_condition = ${if or {{def:tls_cipher}{match_ip{$sender_host_address}{+loopback}}}{1}{0}}

######################################################################
#                 DO NOT EDIT Exim Webuzo Rewrite
######################################################################

# There are no rewriting specifications in this default configuration file.

begin rewrite

######################################################################
#                 DO NOT EDIT Exim Webuzo ROUTERS
######################################################################

begin routers

blackhole_dovenull:
    driver= redirect
    local_parts = "@dovenull"
    allow_fail = true
    data = :fail: Unrouteable address
	
# Check Demo user
democheck:
    driver = redirect
    require_files = "+/etc/demouids"
    condition = ${if >= {$originator_uid}{100}{1}{0}}
    condition = "${extract{size}{${stat:/etc/demouids}}}"
    condition = "${if eq \
        {${lookup \
            {$originator_uid} \
            lsearch{/etc/demouids} \
            {$value} \
        }} \
        {} \
        {false} \
        {true} \
    }"
    allow_fail
    data = :fail: demo accounts are not permitted to relay email

# check email count per hour domain or user || Check other stuff also (TODO E.G. SUSPEND DOMAIN, USER AND PERTICULAR EMAIL ACCOUNT)	
check_mail_validity:
    domains = ! +local_domains
    condition =  ${if eq {$authenticated_id}{root}{0}{1}}
    ignore_target_hosts = +loopback
    driver = redirect
    allow_fail
    #allow_filter
    allow_defer
    #reply_transport = address_reply
    no_verify
    user = "exim" 
    expn = false
    condition = "${perl{check_mail_validity}}"
    data = "${perl{check_mail_validity_results}}"
	
#
# Increments max emails per hour if needed (to do)
#
increment_email_per_hour_count:
    domains = ! +local_domains
    ignore_target_hosts = +loopback
    condition =  ${if eq {$authenticated_id}{root}{0}{1}}
    driver = redirect
    allow_fail
    no_verify
    one_time
    expn = false
    condition = "${perl{increment_email_per_hour_count_if}}"
    data = ":unknown:"

manualmx:
    driver = manualroute
    domains = +manualmx_domains
    transport = remote_smtp
    route_data = ${lookup \
        {$domain} \
        lsearch{/etc/manualmx} \
    }
	
autoreply_dkim_lookuphost:
    driver = dnslookup
    domains = ! +local_domains
    condition = "${perl{sender_domain_can_dkim_sign}}"
    condition = "${if \
        or { \
            {match{$h_precedence:}{auto}} \
            {match{$h_x-precedence:}{auto}} \
        } \
        {1}{0} \
    }"
    #ignore verisign to prevent waste of bandwidth
    ignore_target_hosts = +loopback
    headers_add = "${perl{mailtrapheaders}}"
    transport = dkim_remote_smtp
	
dkim_lookuphost:
    driver = dnslookup
    domains = ! +local_domains
    condition = "${perl{sender_domain_can_dkim_sign}}"
    #ignore verisign to prevent waste of bandwidth
    ignore_target_hosts = +loopback
    headers_add = "${perl{mailtrapheaders}}"
    transport = dkim_remote_smtp

suspended_script:
	driver = redirect
	allow_fail
	condition = ${lookup{$sender_address}lsearch{/etc/mail_script_suspended}{1}{0}}
	data = :blackhole:
	
lookuphost:
    driver = dnslookup
    domains = ! +local_domains
    #ignore verisign to prevent waste of bandwidth
    ignore_target_hosts = +loopback
    headers_add = "${perl{mailtrapheaders}}"
    transport = remote_smtp

literal:
    driver = ipliteral
    domains = ! +local_domains
    ignore_target_hosts = +loopback : 64.94.110.0/24
    headers_add = "${perl{mailtrapheaders}}"
    transport = remote_smtp


######################################################################
#                      DIRECTORS CONFIGURATION                       #
#             Specifies how local addresses are handled              #
######################################################################
#                          ORDER DOES MATTER                         #
#   A local address is passed to each in turn until it is accepted.  #
######################################################################

#Suspended User will not receive any mail
suspended_user:
	driver = redirect
	allow_fail
	domains = lsearch;/etc/userdomains
	condition = ${if exists {/etc/exim/users/${lookup{$domain}lsearch{/etc/userdomains}{$value}}/.${sg{$local_part}{\N[/+].*\N}{}}@${domain}.suspended_incoming}}
	data = :fail: The $local_part@$domain is suspended to receive any incoming mail.

# filter on user level
user_filter:
    driver = redirect
    allow_filter
    allow_fail
    forbid_filter_run
    forbid_filter_perl
    forbid_filter_lookup
    forbid_filter_readfile
    forbid_filter_readsocket
    no_check_local_user
    domains = lsearch;/etc/userdomains
    require_files = "/etc/exim/users/${lookup{$domain}lsearch{/etc/userdomains}{$value}}/filter"
    condition = "${extract \
        {size} \
        {${stat:/etc/exim/users/${lookup{$domain}lsearch{/etc/userdomains}{$value}}/filter}} \
    }"
    file = /etc/exim/users/${lookup{$domain}lsearch{/etc/userdomains}{$value}}/filter
    file_transport = address_file
    directory_transport = address_directory
    reply_transport = address_reply
    pipe_transport = address_pipe
    router_home_directory = ${extract \
        {5} \
        {::} \
        {${lookup passwd \
            {${lookup \
                {$domain} \
                lsearch{/etc/userdomains} \
                {$value} \
            }} \
            {$value} \
        }} \
    }
    user = "${lookup \
        {$domain} \
        lsearch{/etc/userdomains} \
        {$value} \
    }"
	group = "${lookup \
        {$domain} \
        lsearch{/etc/userdomains} \
        {$value} \
    }"
    no_verify

# A filter on Domain level
domain_filter:
    driver = redirect
    allow_filter
    allow_fail
    forbid_filter_run
    forbid_filter_perl
    forbid_filter_lookup
    forbid_filter_readfile
    forbid_filter_readsocket
    no_check_local_user
    domains = lsearch;/etc/userdomains
    require_files = "/etc/exim/users/${lookup{$domain}lsearch{/etc/userdomains}{$value}}/${perl{untaint}{$domain}}/filter"
    condition = "${extract \
        {size} \
        {${stat:/etc/exim/users/${lookup{$domain}lsearch{/etc/userdomains}{$value}}/${perl{untaint}{$domain}}/filter}} \
    }"
    file = /etc/exim/users/${lookup{$domain}lsearch{/etc/userdomains}{$value}}/${perl{untaint}{$domain}}/filter
    file_transport = address_file
    directory_transport = address_directory
    reply_transport = address_reply
    pipe_transport = address_pipe
    router_home_directory = ${extract \
        {5} \
        {::} \
        {${lookup passwd \
            {${lookup \
                {$domain} \
                lsearch{/etc/userdomains} \
                {$value} \
            }} \
            {$value} \
        }} \
    }
    user = "${lookup \
        {$domain} \
        lsearch{/etc/userdomains} \
        {$value} \
    }"
	group = "${lookup \
        {$domain} \
        lsearch{/etc/userdomains} \
        {$value} \
    }"
    no_verify
	
# A filter on Email level
email_filter:
    driver = redirect
    allow_filter
    allow_fail
    forbid_filter_run
    forbid_filter_perl
    forbid_filter_lookup
    forbid_filter_readfile
    forbid_filter_readsocket
    no_check_local_user
    domains = lsearch;/etc/userdomains
    require_files = "/etc/exim/users/${lookup{SAFEDOMAIN}lsearch{/etc/userdomains}{$value}}/SAFEDOMAIN/SAFELOCALPART/filter"
    condition = "${extract \
        {size} \
        {${stat:/etc/exim/users/${lookup{SAFEDOMAIN}lsearch{/etc/userdomains}{$value}}/SAFEDOMAIN/SAFELOCALPART/filter}} \
    }"
    file = /etc/exim/users/${lookup{SAFEDOMAIN}lsearch{/etc/userdomains}{$value}}/SAFEDOMAIN/SAFELOCALPART/filter
    file_transport = address_file
    directory_transport = address_directory
    reply_transport = address_reply
    pipe_transport = address_pipe
    router_home_directory = ${extract \
        {5} \
        {::} \
        {${lookup passwd \
            {${lookup \
                {$domain} \
                lsearch{/etc/userdomains} \
                {$value} \
            }} \
            {$value} \
        }} \
    }
    user = "${lookup \
        {$domain} \
        lsearch{/etc/userdomains} \
        {$value} \
    }"
	group = "${lookup \
        {$domain} \
        lsearch{/etc/userdomains} \
        {$value} \
    }"
	local_part_suffix = +*
    local_part_suffix_optional
    retry_use_local_part
    no_verify

#autoreply exists
#both passwd and forwarders do not have local_part.
userautoreply:
  driver = accept
  domains = lsearch;/etc/userdomains
	router_home_directory = ${extract \
        {5} \
        {::} \
        {${lookup passwd \
            {${lookup \
                {$domain} \
                lsearch{/etc/userdomains} \
                {$value} \
            }} \
            {$value} \
        }} \
    }
	user = "${lookup \
        {$domain} \
        lsearch{/etc/userdomains} \
        {$value} \
    }"
  #local_parts = ${lookup{$local_part} dsearch,ret=full{${extract{5}{::}{${lookup passwd{${lookup{$domain}lsearch{/etc/userdomains}{$value}}}{$value}}}}/etc/${domain}/autorespond/}}
  condition = ${if exists{/etc/exim/users/${lookup{$domain}lsearch{/etc/userdomains}{$value}}/${perl{untaint}{$domain}}/autorespond/${local_part}/${local_part}@${perl{untaint}{$domain}}.msg}{yes}{no}}
  condition = ${if match{$h_X-Spam-Status:}{\N^Yes\N}{no}{yes}}
  require_files = /etc/exim/users/${lookup{$domain}lsearch{/etc/userdomains}{$value}}/${perl{untaint}{$domain}}/autorespond/${local_part}/${local_part}@${perl{untaint}{$domain}}.msg
  condition = ${if exists{/etc/exim/users/${lookup{$domain}lsearch{/etc/userdomains}{$value}}/${perl{untaint}{$domain}}/passwd}}
  
   # Check if the current time is between start and stop times
  condition = ${if and { \
		{>= {${run{/bin/date +%Y%m%d%H%M}}}{${if eq {${readfile{${perl{untaint}{/etc/exim/users/${lookup{$domain}lsearch{/etc/userdomains}{$value}}/${perl{untaint}{$domain}}/autorespond/${local_part}/${local_part}@${perl{untaint}{$domain}}.starttime}}}}}{}{${run{/bin/date +%Y%m%d%H%M}}}{${readfile{${perl{untaint}{/etc/exim/users/${lookup{$domain}lsearch{/etc/userdomains}{$value}}/${perl{untaint}{$domain}}/autorespond/${local_part}/${local_part}@${perl{untaint}{$domain}}.starttime}}}}}}}} \
		{<= {${run{/bin/date +%Y%m%d%H%M}}}{${if eq {${readfile{${perl{untaint}{/etc/exim/users/${lookup{$domain}lsearch{/etc/userdomains}{$value}}/${perl{untaint}{$domain}}/autorespond/${local_part}/${local_part}@${perl{untaint}{$domain}}.stoptime}}}}}{}{999912312359}{${readfile{${perl{untaint}{/etc/exim/users/${lookup{$domain}lsearch{/etc/userdomains}{$value}}/${perl{untaint}{$domain}}/autorespond/${local_part}/${local_part}@${perl{untaint}{$domain}}.stoptime}}}}}}}} \
	  } {yes}{no}}
  
  # Prevent the autoresponder email from being sent repeatedly.
  condition = ${if def:h_Auto-submitted:{${if match{$h_Auto-submitted:}{\N^no\N\}{yes}{no}}}{yes}}

  # do not reply to errors and bounces or lists
  senders = " ! ^.*-request@.*:\
              ! ^owner-.*@.*:\
              ! ^postmaster@.*:\
              ! ^listmaster@.*:\
              ! ^mailer-daemon@.*\
              ! ^root@.*"
  transport = userautoreply
  unseen
  
virtual_aliases:
    driver = redirect
    allow_defer
    allow_fail
    domains = lsearch;/etc/userdomains
    user = "${lookup \
        {$domain} \
        lsearch{/etc/userdomains} \
        {$value} \
    }"
	group = "${lookup \
        {$domain} \
        lsearch{/etc/userdomains} \
        {$value} \
    }"
    address_data = \
        "router=$router_name \
        redirect=${quote:${lookup \
            {$local_part} \
            lsearch{/etc/exim/users/${lookup{$domain}lsearch{/etc/userdomains}{$value}}/${perl{untaint}{$domain}}/aliases} \
    }}"
    data = ${sg{${extract{redirect}{$address_data}}}{"}{}}
    file_transport = address_file
    pipe_transport = address_pipe
    local_part_suffix = +*
    local_part_suffix_optional
    retry_use_local_part
    unseen

#
# Virtual User Spam Boxes
#

virtual_user_spam:
	driver = accept
	local_parts = +path_safe_localparts
	domains = +local_domains
	condition = ${if match{$h_x-spam-status:}{\N^Yes\N}{true}{false}}
	require_files = +${extract{5}{::}{${lookup passwd{${lookup{$domain}lsearch{/etc/userdomains}{$value}}}{$value}}}}/.spamassassinboxenable : +${extract{5}{::}{${lookup passwd{${lookup{$domain}lsearch{/etc/userdomains}{$value}}}{$value}}}}/mail/$domain/$local_part
    router_home_directory = ${extract \
        {5} \
        {::} \
        {${lookup passwd \
            {${lookup \
                {$domain} \
                lsearch{/etc/userdomains} \
                {$value} \
            }} \
            {$value} \
        }} \
    }
	cannot_route_message = Unknown user
	transport = maildir_spam_delivery

virtual_boxtrapper_user:
  driver = accept
  local_parts = +path_safe_localparts
  domains = \
        : ${lookup \
            {$domain} \
            lsearch{/etc/userdomains} \
            {${perl{untaint}{$domain}}} \
        }
  require_files = "+/var/softaculous/apps/exim/boxtrapper.php:+/etc/exim/users/${lookup{$domain}lsearch{/etc/userdomains}{$value}}/${domain}/boxtrapper/${local_part}/.enabled"
  user = ${lookup{$domain}lsearch{/etc/userdomains}{$value}}
  headers_remove="x-uidl"
  transport = virtual_boxtrapper_userdelivery

virtual_user:
    driver = accept
    domains = \
        : ${lookup \
            {$domain} \
            lsearch{/etc/userdomains} \
            {${perl{untaint}{$domain}}} \
        }
    local_parts = +path_safe_localparts
    require_files = "+${extract \
        {5} \
        {::} \
        {${lookup passwd \
            {${lookup \
                {$domain} \
                lsearch{/etc/userdomains} \
                {$value} \
            }} \
            {$value} \
        }} \
    }/mail/$domain/$local_part"
    router_home_directory = ${extract \
        {5} \
        {::} \
        {${lookup passwd \
            {${lookup \
                {$domain_data} \
                lsearch{/etc/userdomains} \
                {$value} \
            }} \
            {$value} \
        }} \
    }
    headers_remove="x-uidl"
    local_part_suffix = +*
    local_part_suffix_optional
    user = "${lookup{$domain}lsearch{/etc/userdomains}{$value}}"
    group = "exim"
    transport = dovecot_delivery
    set = r_bcc_addr=${if forany \
        {${addresses:$h_to:}:${addresses:$h_cc:}} \
        {or { \
            {eqi \
                {${extract{1}{+}{${local_part:$item}}}@${domain:$item}} \
                {$local_part@$domain} \
            } \
            {eqi \
                {${extract{1}{+}{${local_part:$item}}}@${domain:$item}} \
                {$original_local_part@$original_domain} \
            } \
        }} \
        {} \
        {$local_part@$domain} \
    }
    set = r_webuzo_u=${lookup \
        {$domain} \
        lsearch{/etc/userdomains} \
        {$value} \
    }

has_alias_but_no_mailbox_discarded_to_prevent_loop:
    driver = redirect
    domains = lsearch;/etc/userdomains
    condition = ${lookup \
        {$local_part} \
        lsearch{/etc/exim/users/${lookup{$domain}lsearch{/etc/userdomains}{$value}}/${perl{untaint}{$domain}}/aliases} \
        {1} \
        {0} \
    }
    condition = "${if forany{<, \
        ${lookup \
            {$local_part} \
	    lsearch{/etc/exim/users/${lookup{$domain}lsearch{/etc/userdomains}{$value}}/${perl{untaint}{$domain}}/aliases} \
            {$value} \
        }} \
        {!match{$item}{\N/autorespond\N}} \
        {1} \
        {${if match \
            {${lookup \
                {\N*\N} \
		lsearch{/etc/exim/users/${lookup{$domain}lsearch{/etc/userdomains}{$value}}/${perl{untaint}{$domain}}/aliases} \
                {$value} \
            }} \
            {:fail:} \
            {1} \
            {0} \
        }} \
    }"
    data=":blackhole:"
    local_part_suffix = +*
    local_part_suffix_optional
    disable_logging = true

# TODO
#valias_domain_file:
 # driver = redirect
 # allow_defer
 # allow_fail
 # domains = lsearch;/etc/userdomains
 # user = "${lookup{$domain_data}lsearch{/etc/userdomains}{$value}}"
 # group = "${lookup{$domain_data}lsearch{/etc/userdomains}{$value}}"
 # condition = ${lookup {$domain} lsearch {/etc/exim/users/${lookup{$domain}lsearch{/etc/userdomains}{$value}}/etc/$domain/domaliases}{yes}{no} }
 # address_data = router=$router_name redirect=${quote:${quote_local_part:$local_part}@${lookup{$domain}lsearch{/etc/exim/users/${lookup{$domain}lsearch{/etc/userdomains}{$value}}/etc/$domain/domaliases}}}
 # data = ${extract{redirect}{$address_data}}
  

local_aliases:
    driver = redirect
	require_files = /etc/localaliases
    allow_defer
    allow_fail
    domains = $primary_hostname : localhost
    address_data = \
        "router=$router_name \
        redirect=${quote: \
            ${lookup \
                {$local_part} \
                lsearch{/etc/localaliases} \
            }}"
    data = ${extract{redirect}{$address_data}}
    file_transport = address_file
    pipe_transport = address_pipe
    check_local_user

userforward:
    driver = redirect
    allow_filter
    allow_fail
    forbid_filter_run
    forbid_filter_perl
    forbid_filter_lookup
    forbid_filter_readfile
    forbid_filter_readsocket
    check_ancestor
    check_local_user
    domains = $primary_hostname
    no_expn
    require_files = "+$home/.forward"
    condition = "${extract{size}{${stat:$home/.forward}}}"
    file = $home/.forward
    file_transport = address_file
    reply_transport = address_reply
    directory_transport = address_directory
    user = $local_part_data
    group = $local_part_data
    no_verify


localuser_root:
    driver = redirect
    allow_fail
    domains = $primary_hostname : localhost
    check_local_user
    condition = ${if eq {$local_part_data}{root}}
    data = :fail: root cannot accept local mail deliveries
	

localuser_overquota:
  driver = redirect
  domains = $primary_hostname
  check_local_user
  # NB: On busy servers Dovecot may take several seconds to respond to
  # this request. So we set the timeout generously:
  condition =  "${if match {${readsocket{/var/run/dovecot/quota-status}{request=smtpd_access_policy\nrecipient=${quote:$local_part}\nsize=$message_size\n\n}{30s}{\n}{SOCKETFAIL}}}{action=5}{true}{false}}"

  data = ":fail:Mailbox is full / Blocks limit exceeded / Inode limit exceeded"
  verify_only
  allow_fail

#
# Optimized spambox router
#

localuser_spam:
    driver = redirect
    domains = $primary_hostname
    condition  = ${if exists{/etc/global_spamassassin_enable}{1}{${if exists{${extract{5}{::}{${lookup passwd{${if eq{$domain}{$primary_hostname}{${sg{$local_part}{\N[/+].*\N}{}}}{${lookup{$domain}lsearch{/etc/userdomains}}}}}}}}/.spamassassindisable}{0}{1}}}}
    condition = ${if match{$h_x-spam-status:}{\N^Yes\N}{true}{false}}
# sets home,user,group
    check_local_user
    headers_remove="x-uidl"
    data = "${quote_local_part:$local_part_data}+spam"
    redirect_router = localuser
	
localuser:
    driver = accept
# sets home,user,group
    check_local_user
    domains = $primary_hostname
    headers_remove="x-uidl"
    local_part_suffix = +*
    local_part_suffix_optional
    user = ${lookup{$domain}lsearch{/etc/userdomains}{$value}}
    group = exim
    transport = dovecot_delivery
    set = r_bcc_addr=${if forany \
        {${addresses:$h_to:}:${addresses:$h_cc:}} \
        {or { \
            { eqi \
                {${extract \
                    {1} \
                    {+} \
                    {${local_part:$item}} \
                }@${domain:$item}} \
                {$local_part@$domain} \
            } \
            { eqi \
                {${extract \
                    {1} \
                    {+} \
                    {${local_part:$item}} \
                }@${domain:$item}} \
                {$original_local_part@$original_domain} \
            } \
        }} \
        {} \
        {$local_part@$domain} \
    }
    set = r_webuzo_u=${local_part}

split_delivery:
    driver = manualroute
    domains = lsearch;/etc/exim_no_catchall
    transport = remote_smtp
    condition = ${if match_ip{$sender_host_address}{+loopback}{1}{${lookup{$domain}lsearch{/etc/exim_no_catchall_final_host}{0}{1}}}}
    route_data = ${lookup \
        {$domain} \
        lsearch{/etc/exim_no_catchall} \
    }
	
#To catch all the failed mail
catchall:
    driver = redirect
    domains = lsearch;/etc/userdomains
	address_data = \
        "router=$router_name \
        redirect=${quote:${lookup \
            {*} \
            lsearch{/etc/exim/users/${lookup{$domain}lsearch{/etc/userdomains}{$value}}/${perl{untaint}{$domain}}/aliases} \
    }}"
    data = ${sg{${extract{redirect}{$address_data}}}{"}{}}
    pipe_transport = address_pipe
	allow_fail

dnslookup:
  driver = dnslookup
  domains = ! +local_domains
  transport = remote_smtp
  ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
  no_more


#################################################################################
#                 DO NOT EDIT Exim Webuzo TRANSPORTS
#		This transport is used for delivering messages over SMTP connections.
#################################################################################

begin transports

remote_smtp:
    driver = smtp 
    dkim_domain = ${lc:${domain:$h_from:}}
    dkim_selector = default
    dkim_private_key = /var/webuzo-data/mail/dkim/private/${perl{untaint}{${dkim_domain}}}
    dkim_canon = relaxed
    interface = <; ${if > {${extract{size}{${stat:/etc/mailips}}}}{0}{${lookup{${lc:${perl{get_message_sender_domain}}}}lsearch{/etc/mailips}{$value}{${lookup{${if match_domain{$original_domain}{+relay_domains}{${lc:$original_domain}}{}}}lsearch{/etc/mailips}{$value}{${lookup{${perl{get_sender_from_uid}}}lsearch*{/etc/mailips}{$value}{}}}}}}}}
    helo_data = ${if exists {/etc/mailhelo}{${lookup{$sender_address_domain}lsearch{/etc/mailhelo}{$value}{$primary_hostname}}}{$primary_hostname}}
    message_linelength_limit = 2048

remote_smtp_old:
  driver = smtp
  #interface = <; ${if > {${extract{size}{${stat:/etc/mailips}}}}{0}{${lookup{${lc:${perl{get_message_sender_domain}}}}lsearch{/etc/mailips}{$value}{${lookup{${if match_domain{$original_domain}{+relay_domains}{${lc:$original_domain}}{}}}lsearch{/etc/mailips}{$value}{${lookup{${perl{get_sender_from_uid}}}lsearch*{/etc/mailips}{$value}{}}}}}}}}
  #helo_data = ${if > {${extract{size}{${stat:/etc/mailhelo}}}}{0}{${lookup{${lc:${perl{get_message_sender_domain}}}}lsearch{/etc/mailhelo}{$value}{${lookup{${if match_domain{$original_domain}{+relay_domains}{${lc:$original_domain}}{}}}lsearch{/etc/mailhelo}{$value}{${lookup{${perl{get_sender_from_uid}}}lsearch*{/etc/mailhelo}{$value}{$primary_hostname}}}}}}}{$primary_hostname}}
  #hosts_try_chunking = 198.51.100.1
  helo_data = ${lookup dnsdb{ptr=$sending_ip_address}{$value}{$primary_hostname}}
  dkim_domain = ${lc:${domain:$h_from:}}

dkim_remote_smtp:
  driver = smtp
  interface = <; ${if > {${extract{size}{${stat:/etc/mailips}}}}{0}{${lookup{${lc:${perl{get_message_sender_domain}}}}lsearch{/etc/mailips}{$value}{${lookup{${if match_domain{$original_domain}{+relay_domains}{${lc:$original_domain}}{}}}lsearch{/etc/mailips}{$value}{${lookup{${perl{get_sender_from_uid}}}lsearch*{/etc/mailips}{$value}{}}}}}}}}
  #helo_data = ${if > {${extract{size}{${stat:/etc/mailhelo}}}}{0}{${lookup{${lc:${perl{get_message_sender_domain}}}}lsearch{/etc/mailhelo}{$value}{${lookup{${if match_domain{$original_domain}{+relay_domains}{${lc:$original_domain}}{}}}lsearch{/etc/mailhelo}{$value}{${lookup{${perl{get_sender_from_uid}}}lsearch*{/etc/mailhelo}{$value}{$primary_hostname}}}}}}}{$primary_hostname}}
  dkim_domain = ${lc:${domain:$h_from:}} 
  dkim_selector = default
  dkim_private_key = "/var/webuzo-data/mail/dkim/private/${perl{untaint}{${dkim_domain}}}"
  dkim_canon = relaxed
  helo_data = ${lookup dnsdb{ptr=$sending_ip_address}{$value}{$primary_hostname}}
  #hosts_try_chunking = 198.51.100.1
  message_linelength_limit = 2048

virtual_boxtrapper_userdelivery:
  driver = pipe
  command = /var/softaculous/apps/exim/boxtrapper.php
  user = exim
  group = ${lookup{$domain}lsearch{/etc/userdomains}{$value}}
  log_output = true
  return_fail_output = true
  return_path_add = false
  temp_errors = 64 : 69 : 70: 71 : 72 : 73 : 74 : 75 : 78

address_directory:
  driver = appendfile
  maildir_format
  maildir_use_size_file
  delivery_date_add
  envelope_to_add
  return_path_add
  
address_pipe:
    driver = pipe
    return_output
	

virtual_address_pipe:
    driver = pipe
    return_output
	
address_file:
	debug_print = "T: address_file for $local_part@$domain"
	driver = appendfile
	delivery_date_add
	envelope_to_add
	return_path_add
	mode = 0660
	
dovecot_delivery:
    driver = lmtp
    socket = /var/run/dovecot/lmtp
    batch_max = 200
    batch_id = "$r_webuzo_u ${if def:r_bcc_addr {$r_bcc_addr}}"
    rcpt_include_affixes
    delivery_date_add
    envelope_to_add
    return_path_add

vmail_delivery:
    driver = lmtp
	user = "${lookup{$domain_data}lsearch{/etc/userdomains}{$value}}"
	group = "${lookup{$domain_data}lsearch{/etc/userdomains}{$value}}"
    socket = /var/run/dovecot/lmtp
    batch_max = 200
    batch_id = "$r_webuzo_u ${if def:r_bcc_addr {$r_bcc_addr}}"
    rcpt_include_affixes
    delivery_date_add
    envelope_to_add
    return_path_add

maildir_spam_delivery:
	driver = appendfile
	directory = $home/mail/${lookup{$domain}dsearch{$home/mail/}}/${lookup{$local_part}dsearch{$home/mail/${lookup{$domain}dsearch{$home/mail/}}/}}/.spam
	create_directory = true
	delivery_date_add
	envelope_to_add
	return_path_add
	maildir_format
	mode = 0660
	user = ${lookup{$domain}lsearch{/etc/userdomains}{$value}}
	group = ${lookup{$domain}lsearch{/etc/userdomains}{$value}}
	
dovecot_virtual_delivery:
  driver = appendfile
  delivery_date_add
  #directory_mode = 770
  envelope_to_add
  #router_home_directory = ${extract{5}{::}{${lookup passwd{${lookup{$domain}lsearch{/etc/userdomains}{$value}}}{$value}}}}
  directory = $home/mail/${lookup{$domain}dsearch{$home/mail/}}/${lookup{$local_part}dsearch{$home/mail/${lookup{$domain}dsearch{$home/mail/}}/}}
  #file = ${extract{5}{::}{${lookup passwd{${lookup{$domain}lsearch{/etc/userdomains}{$value}}}{$value}}}}/mail/$domain/$local_part
  maildir_format
  create_directory = true
  group = ${lookup{$domain}lsearch{/etc/userdomains}{$value}}
  mode = 0660
  return_path_add
  user = ${lookup{$domain}lsearch{/etc/userdomains}{$value}}
	
address_reply:
    driver = autoreply
	
userautoreply:
    driver = autoreply
    user = exim
    headers = ${if exists{/etc/exim/users/${lookup{SAFEDOMAIN}lsearch{/etc/userdomains}{$value}}/SAFEDOMAIN/autorespond/SAFELOCALPART/SAFELOCALPART@SAFEDOMAIN.header}{\
                ${readfile{/etc/exim/users/${lookup{SAFEDOMAIN}lsearch{/etc/userdomains}{$value}}/SAFEDOMAIN/autorespond/SAFELOCALPART/SAFELOCALPART@SAFEDOMAIN.header}}\
            }{}}
    file = /etc/exim/users/${lookup{SAFEDOMAIN}lsearch{/etc/userdomains}{$value}}/SAFEDOMAIN/autorespond/SAFELOCALPART/SAFELOCALPART@SAFEDOMAIN.msg
    from = "${local_part}@${domain}"
    no_return_message
    subject = ${if def:h_Subject: {\
	    ${if exists{/etc/exim/users/${lookup{SAFEDOMAIN}lsearch{/etc/userdomains}{$value}}/SAFEDOMAIN/autorespond/SAFELOCALPART/SAFELOCALPART@SAFEDOMAIN.subj}\
		{${readfile{/etc/exim/users/${lookup{SAFEDOMAIN}lsearch{/etc/userdomains}{$value}}/SAFEDOMAIN/autorespond/SAFELOCALPART/SAFELOCALPART@SAFEDOMAIN.subj}{}}}\
		{Autoreply}\
	}: ${sg{$rh_Subject:}{\n}{}}}\
	{Autoreply Message}}
    to = "${reply_address}"

	
######################################################################
#                      exim Webuzo RETRY CONFIGURATION                      
######################################################################

# Domain               Error       Retries
# ------               -----       -------


begin retry

+secondarymx           *           F,4h,5m; G,16h,1h,1.5; F,4d,8h
*           *           F,2h,15m; G,16h,1h,1.5; F,4d,6h

https://t.me/RX1948 - 2025