[SOLVED] bulk add users whitelist / blacklist entries with file txt

Baskworo

New Member
Feb 8, 2022
3
1
3
35
Hallo i'm new on proxmox mail gateway, i wont to ask about entry blacklist mail with txt.

i have txt file with name "coba.txt" with file in attachment.

after that i upload file "coba.txt" on directory "/source/coba.txt" , i command like this :
while read line;do pmgsh create /config/ruledb/who/2/email --email "$line" ; done < /source/coba.txt

and then i have error :
400 Parameter verification failed.
email: invalid format - value does not look like a valid email address

create config/ruledb/who/2/email --email <string> [OPTIONS]
 

Attachments

On a hunch - I think this is because the file has DOS lineendings (CRLF instead of unix line endings (only LF))
also I think that you need to put a newline after the last line as well

I hope this helps!
 
  • Like
Reactions: Baskworo
On a hunch - I think this is because the file has DOS lineendings (CRLF instead of unix line endings (only LF))
also I think that you need to put a newline after the last line as well

I hope this helps!
ok note, and i have try this solution..
DONE and Solved...
Thankyou @Stoiko Ivanov

so i want to summarize about how to blacklist with "file.txt" if you have many list mail blacklist :
1. you can create file type txt, but before you run this file you can check file with line windows(CRLF) / line with file MAC(CR), this filetype must (LF). you can check with cli ='cat -A file.txt'
if windows line result like this: humas.diklat4@gmail.com^M$ humas.diklat3@gmail.com^M$ if linux line like this : marketing.pusdiknas12@gmail.com$ panitia.diklat025@gmail.com$

2. check your blacklist or whitelist column with code "pmgsh get /config/ruledb/who" , result like this
[ { "id" : 2, "info" : "Global blacklist", "name" : "Blacklist" }, { "id" : 3, "info" : "Global whitelist", "name" : "Whitelist" } ]

3. run this comment "while read line;do pmgsh create /config/ruledb/who/2/email --email "$line" ; done < /source/file.txt" and example result like this :
200 OK 44 200 OK 45

Thankyou and i hope this summarize help us and other.

Baskworo
 
Last edited:
  • Like
Reactions: Stoiko Ivanov