First make sure you have a backup of the target antispam database.
One way would be to use the SQL Manager of IceWarp console - advantage being that the procedure is the same for MySQL, MS SQL and SQLite :
- select antispam database containing the records
- execute the following query
SELECT * from Senders where SndOwner = '<email>' and (SndAuthorized = 0 or SndAuthorized = 1)
- export the result to .CSV file
- edit the .CSV file with a modern editor (notepad++ is perfect)
** delete the first line (headers)
** replace
;
by
','
** add at the beginning of each line :
INSERT INTO Senders (SndEmail, SndAuthorized, SndCreatedOn, SndCreatedAt, SndFolder, SndOwner, SndDomain, SndSubject, SndIP, SndWord) VALUES ('
** replace at the end of each line :
,'
by
);
- select target antispam database
- copy/paste the result in the SQL Manager
- execute the queries
If editing the result of the query is not an option, the procedure is specific to DB type.
MySQL
-----
mysqldump -u !user! -p!password! -w "SndOwner = '!email!' and (SndAuthorized = 0 or SndAuthorized = 1)" !backup-antispam-database-name! Senders --no-create-info --skip-triggers >BL-WL.sql
followed by
mysql -u !user! -p!password! !target-antispam-database-name! <BL-WL.sql
(replace !user!, !password!, !email!, !backup-antispam-database-name! and !target-antispam-database-name! with appropriate values)
MS SQL
------
bcp "select * from !backup-antispam-database-name!.!schema-name!.Senders where SndOwner = '!email!' and (SndAuthorized = 0 or SndAuthorized = 1)" queryout "BL-WL.sql" -U!user! -P!password! -w -t "||"
followed by
bcp !target-antispam-database-name!.!schema-name!.Senders in "BL-WL.sql" -U!user! -P!password! -w -t "||"
(replace !user!, !password!, !email!, !schema-name!, !backup-antispam-database-name! and !target-antispam-database-name! with appropriate values)
SQLite (you will need sqlite3 binary : https://sqlite.org/download.html)
------
sqlite3 "!backup-antispam-database-name!"
SQLite version 3.8.6 2014-08-15 11:46:33
Enter ".help" for usage hints.
sqlite> .mode insert Senders
sqlite> .out "BL-WL.sql"
sqlite> select * from Senders where SndOwner = '!email!' and (SndAuthorized = 0 or SndAuthorized = 1);
sqlite> .quit
followed by
sqlite3 "!target-antispam-database-name!" <BL-WL.sql
(replace !email!, !backup-antispam-database-name! and !target-antispam-database-name! with appropriate values)
Courtesy of Vineeta
Comments
0 comments
Please sign in to leave a comment.