import list (text file) via ssh


I have a text file (file1.txt) with over 20k emails
I know many of you will say just import via tools yeah I know I did it many times but I'm thinking about do it in a different way like this:

I want to convert file1.txt to file2.sql file then execute ssh command line below inside a shell script
mysql -uroot -p$sqlpass mailwizz < /folder1/file2.sql

is this possible? any idea ? please help

PS: in my mailwizz there is already a blacklisted emails

Thank you
@elammari - The way you want it will not work for so many reasons :)
Mailwizz has a command line command to import lists from command line, so maybe you will want to try that:
/usr/bin/php /absolute/ list-import --list_uid=13CharsUniqueListID --file_path=/the/path/to/the/txtfile/on/the/server.txt
@twisted1919 you think that command line will work?

is it possible to create a list (name, address, etc,...) via a command line ?

my goal is to automate this process: create list+upload list with a script having few commands
Last edited:
@elammari - you mean the script i told you about ? yes that will work always.
my goal is to automate this process: create list+upload list with a script having few commands
Give us more details, let's say you run the command from command line, then where is the file that needs imported?

Because, you can use the API to create a list:
Then you can use the above example i gave you to import in that list.

So it's just 2 command line commands ;)
@elammari - okay, in order for me to help you with this. Go to backend > misc > cron jobs list, and copy/paste here the send-campaigns cron job line.
So, first step is to use the api to create a php script that will create our list.
I attached an archive, unzip it, then open the create-list.php file on your pc and edit it properly, by adding your API url and API keys.
You can get this info from Customer Area > Api Keys.
Next, in this file, you also have some list attributes, like description, emails, company info, etc. Maybe sure you fill those.
Once you did this, upload the create-list folder in /var/www via sftp and then login via ssh and go in that directory.
#ssh to go in the directory
cd /var/www/create-list/

Once you are in this folder, in order to create a new list you have to run this command:
/usr/bin/php create-list.php --listname="Your list name"

A success command will look like this:
cristi$ php create-list.php --listname="My super list"

THE LIST UID IS: ec833mhcnlf5e

As you can see above, the list unique id in my case is: ec833mhcnlf5e
In your case, it will be different.

Now, we can use this particular list uid to import subscribers in the list, but what exactly do we import?
You said your list will be at a url like so using wget, we can fetch that file into our working folder.
So, run the command:
This downloads the file in the current working folder, in this case /var/www/create-list/ so we should have file1.txt located at /var/www/create-list/file1.txt

Now that we have the file locally, we can tell mailwizz to import it by running this command:
/usr/bin/php /var/www/mw/apps/console/console.php list-import --list_uid=ec833mhcnlf5e --file_path="/var/www/create-list/file1.txt"

So that's all you have to do. It sounds a bit complicated but i think after the initial setup and a few tries, you can get it going pretty easy.

If you have questions, lemme know.


    789.6 KB · Views: 23
after execution of this command
/usr/bin/php /var/www/mw/apps/console/console.php list-import --list_uid=ec833mhcnlf5e --file_path="/var/www/create-list/file1.txt"

I got this below

Error: Unknown action: index

Usage: /var/www/mw/apps/console/console.php list-import <action>

Please advise