Skip to content

Commit

Permalink
fix and finalize #1176
Browse files Browse the repository at this point in the history
  • Loading branch information
usmannasir committed Jan 13, 2024
1 parent 81a531b commit a99c1fa
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
19 changes: 13 additions & 6 deletions emailPremium/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1449,13 +1449,20 @@ def fetchRspamdSettings(request):

postdata = ProcessUtilities.outputExecutioner(command).splitlines()
for i in postdata:
if i.find('smtpd_milters=') > -1 and i.find('non_smtpd_milters') < 0:
if (i.find('smtpd_milters=') > -1 or i.find('smtpd_milters =') > -1) and i.find('non_smtpd_milters') < 0:
### non_smtpd_milters = inet:127.0.0.1:8891, inet:127.0.0.1:11332
tempData = i.split(',')
smtpd_milters = tempData[1].lstrip(' ')
if i.find('non_smtpd_milters=') > -1:
tempData = i.split('=')
non_smtpd_milters = tempData[1].lstrip(' ')
tempData = i.split(',')[1]
if os.path.exists(ProcessUtilities.debugPath):
logging.CyberCPLogFileWriter.writeToFile(f'smtpd_milters: {tempData}')
smtpd_milters = tempData.lstrip(' ')
if i.find('non_smtpd_milters=') > -1 or i.find('non_smtpd_milters =') > -1:
tempData = i.split('=')[1]

if os.path.exists(ProcessUtilities.debugPath):
logging.CyberCPLogFileWriter.writeToFile(f'non_smtpd_milters: {tempData}')

non_smtpd_milters = tempData.lstrip(' ')


###Redis
Redispath = "/etc/rspamd/local.d/redis.conf"
Expand Down
6 changes: 3 additions & 3 deletions plogical/mailUtilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -1028,10 +1028,10 @@ def changePostfixConfig(install , changePostfixConfig):

writeDataToFile = open(postfixpath, "w")
for i in data:
if i.find('smtpd_milters=') > -1 and i.find('non_smtpd_milters') < 0:
newitem = f'non_smtpd_milters = inet:127.0.0.1:8891, {smtpd_milters}\n'
if (i.find('smtpd_milters=') > -1 or i.find('smtpd_milters =') > -1) and i.find('non_smtpd_milters') < 0:
newitem = f'smtpd_milters = inet:127.0.0.1:8891, {smtpd_milters}\n'
writeDataToFile.writelines(newitem + '\n')
elif i.find('non_smtpd_milters=') > -1:
elif i.find('non_smtpd_milters=') > -1 or i.find('non_smtpd_milters =') > -1:
#newitem = 'non_smtpd_milters=%s' % non_smtpd_milters
writeDataToFile.writelines('non_smtpd_milters = $smtpd_milters\n')
else:
Expand Down

0 comments on commit a99c1fa

Please sign in to comment.