Convert Vpopmail alias into qmail alias

From QmailToaster
Revision as of 09:49, 16 March 2024 by Ebroch (talk | contribs) (Created page with "From P.V.Anthony <pvanthony@singnet.com.sg> ---------------------- valias2dotqmail -------------------------------- !/bin/bash ################################################################# # script to convert alias stored in database back to .qmail-alias # # Example. # copy the script into the /home/vpopmail/domains/domain.com # then run: sh valias2dotqmail # ################################################################ # file name for the...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

From P.V.Anthony <pvanthony@singnet.com.sg>

 ---------------------- valias2dotqmail --------------------------------
 !/bin/bash
 #################################################################
 # script to convert alias stored in database back to .qmail-alias
 #
 # Example.
 # copy the script into the /home/vpopmail/domains/domain.com
 # then run: sh valias2dotqmail
 #
 ################################################################
 # file name for the email alias data.
 aliasFile="email_alias.data"
 # owners of the files
 owner="vpopmail"
 # group of the files
 group="vchkpw"
 # get the domain name from the current directory name
 domainName=$(basename $(pwd))
 # get all the aliases.
 ~vpopmail/bin/valias -s $domainName > $aliasFile
 #do the convert now
 while read addr
 do
       fileName=$(echo $addr | cut -d @ -f 1)
       echo $addr | cut -d " " -f 3 >> .qmail-$fileName
      
       # change the owner and group for the dotqmail file
       chown $owner:$group .qmail-$fileName
      
       # change permission of the dotqmail file
       chmod 600 .qmail-$fileName
      
 done < $aliasFile
 # remove the data as we do not need it anymore
 rm $aliasFile
 --------------------------- end ---------------------------------------