https://wiki.zimbra.com/api.php?action=feedcontributions&user=Amit+Srivastava&feedformat=atomZimbra :: Tech Center - User contributions [en]2024-03-29T12:36:04ZUser contributionsMediaWiki 1.39.0https://wiki.zimbra.com/index.php?title=Information_of_all_from_domain_mails_to_a_user&diff=61057Information of all from domain mails to a user2015-10-27T01:02:06Z<p>Amit Srivastava: Amit Srivastava moved page Information of all from domain mails to a user to Information of all from domain mails to a user Amit Srivastava: To have ease of searching</p>
<hr />
<div>#REDIRECT [[Information of all from domain mails to a user Amit Srivastava]]</div>Amit Srivastavahttps://wiki.zimbra.com/index.php?title=Information_of_all_from_domain_mails_to_a_user_Amit_Srivastava&diff=61056Information of all from domain mails to a user Amit Srivastava2015-10-27T01:02:06Z<p>Amit Srivastava: Amit Srivastava moved page Information of all from domain mails to a user to Information of all from domain mails to a user Amit Srivastava: To have ease of searching</p>
<hr />
<div><center><u>'''''Get Information of all from domain mails to a user'''''</u></center><br />
<br />
<br />
''<nowiki># This Article is to get Information from the mailbox of a user that from all which domain he/she got the mail. </nowiki>''<br />
<br />
<br />
''<nowiki># Ref: </nowiki>[https://wiki.zimbra.com/index.php?title=Account_mailbox_database_structure https://wiki.zimbra.com/index.php?title=Account_mailbox_database_structure] ''<br />
<br />
<br />
''<nowiki># su – zimbra </nowiki>''<br />
<br />
''$ zmprov gmi [mailto:user@domain.com user@domain.com]<br />
<br />
''mailboxId: 36''<br />
<br />
''quotaUsed: 65146125877''<br />
<br />
<br />
''Note: mboxgroup <nowiki>= expr mailboxid % 100 </nowiki>''<br />
<br />
''$ expr 36 % 100 ''<br />
<br />
''36''<br />
<br />
<br />
''Note: This means mailbox lie in mboxgroup36 ''<br />
<br />
<br />
''$ mysql mboxgroup36 -e “select * from mail_item where mailbox_id=36” > /tmp/detail.txt''<br />
<br />
<br />
''$ cat /tmp/userdetail.txt|grep -E -o "\b[a-zA-Z0-9.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z.-]+\b" | sort -nr| uniq | cut -d'@' -f2,2 | sort -nr |uniq > /tmp/domains.txt ''</div>Amit Srivastavahttps://wiki.zimbra.com/index.php?title=Information_of_all_from_domain_mails_to_a_user_Amit_Srivastava&diff=61055Information of all from domain mails to a user Amit Srivastava2015-10-27T00:59:21Z<p>Amit Srivastava: Created page with "<center><u>'''''Get Information of all from domain mails to a user'''''</u></center> ''<nowiki># This Article is to get Information from the mailbox of a user that from all..."</p>
<hr />
<div><center><u>'''''Get Information of all from domain mails to a user'''''</u></center><br />
<br />
<br />
''<nowiki># This Article is to get Information from the mailbox of a user that from all which domain he/she got the mail. </nowiki>''<br />
<br />
<br />
''<nowiki># Ref: </nowiki>[https://wiki.zimbra.com/index.php?title=Account_mailbox_database_structure https://wiki.zimbra.com/index.php?title=Account_mailbox_database_structure] ''<br />
<br />
<br />
''<nowiki># su – zimbra </nowiki>''<br />
<br />
''$ zmprov gmi [mailto:user@domain.com user@domain.com]<br />
<br />
''mailboxId: 36''<br />
<br />
''quotaUsed: 65146125877''<br />
<br />
<br />
''Note: mboxgroup <nowiki>= expr mailboxid % 100 </nowiki>''<br />
<br />
''$ expr 36 % 100 ''<br />
<br />
''36''<br />
<br />
<br />
''Note: This means mailbox lie in mboxgroup36 ''<br />
<br />
<br />
''$ mysql mboxgroup36 -e “select * from mail_item where mailbox_id=36” > /tmp/detail.txt''<br />
<br />
<br />
''$ cat /tmp/userdetail.txt|grep -E -o "\b[a-zA-Z0-9.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z.-]+\b" | sort -nr| uniq | cut -d'@' -f2,2 | sort -nr |uniq > /tmp/domains.txt ''</div>Amit Srivastavahttps://wiki.zimbra.com/index.php?title=Ldap_Script_to_get_the_details_in_minimal_time_Amit_Srivastava&diff=60970Ldap Script to get the details in minimal time Amit Srivastava2015-10-02T07:44:23Z<p>Amit Srivastava: </p>
<hr />
<div><center><u>'''''Ldap Script to get the details of user with location parameter'''''</u></center><br />
<br />
<br />
<center><u>''We can add any parameter to search this will consume few seconds only to search the expected result ''</u></center><br />
<br />
<br />
Script Name: get_list_by_ldap.sh<br />
<br />
<nowiki>#!/bin/bash</nowiki><br />
<br />
<nowiki># Use this script from zimbra user </nowiki><br />
<br />
<nowiki># Start of the script </nowiki><br />
<br />
<nowiki># Reference https://wiki.zimbra.com/wiki/ShanxT-LDAP-CheatSheet </nowiki><br />
<br />
source ~/bin/zmshutil<br />
<br />
zmsetvars<br />
<br />
<br />
tmpoutfile=”/tmp/Amit/uidlist.txt”<br />
<br />
rm -vf $tmpoutfile<br />
<br />
<br />
<nowiki>#initially remove any tmp file if exist.</nowiki><br />
<br />
<br />
ldapsearch -x -H $ldap_master_url -D $zimbra_ldap_userdn -w $zimbra_ldap_password -LLL '(&(objectClass=zimbraAccount)(uid=*))' | grep -w uid:> $tmpoutfile<br />
<br />
<br />
<nowiki># Above will list the all uid present in zimbra</nowiki><br />
<br />
<br />
sed -i 's/uid: /uid=/g' $tmpoutfile<br />
<br />
<br />
<nowiki># Above is modifying the ldap search parameter to have the proper input in ldapsearch (replacing uid: by udi=)</nowiki><br />
<br />
<br />
echo "Email_ID's Account_Status Branch" >> $tmpoutfile<br />
<br />
echo "------------------------------------------------" >> $tmpoutfile<br />
<br />
<br />
<nowiki># Below is the starting of the loop which looks from the temprary output file store the values in variable and then have the output accordingly </nowiki><br />
<br />
<br />
for i in `cat $tmpoutfile`<br />
<br />
<br />
do<br />
<br />
<br />
j="(&(objectClass=zimbraAccount)("$i"))"<br />
<br />
<br />
Email_ID=$i<br />
<br />
<br />
Account_Status=`ldapsearch -x -H $ldap_master_url -D $zimbra_ldap_userdn -w $zimbra_ldap_password -LLL $j | grep -w zimbraAccountStatus| cut -d: -f2`<br />
<br />
<br />
Branch=`ldapsearch -x -H $ldap_master_url -D $zimbra_ldap_userdn -w $zimbra_ldap_password -LLL $j | grep -w l:| cut -d: -f2`<br />
<br />
<br />
echo "$Email_ID $Account_Status $Branch ">> $tmpoutfile<br />
<br />
<br />
done<br />
<br />
<nowiki># Script Finished </nowiki></div>Amit Srivastavahttps://wiki.zimbra.com/index.php?title=Ldap_Script_to_get_the_details_in_minimal_time_Amit_Srivastava&diff=60969Ldap Script to get the details in minimal time Amit Srivastava2015-10-02T07:42:55Z<p>Amit Srivastava: </p>
<hr />
<div><center><u>'''''Ldap Script to get the details of user with location parameter'''''</u></center><br />
<br />
<br />
<center><u>''We can add any parameter to search this will consume few seconds only to search the expected result ''</u></center><br />
<br />
<br />
Script Name: get_list_by_ldap.sh<br />
<br />
<nowiki>#!/bin/bash</nowiki><br />
<br />
<nowiki># Made By Amit Srivastava</nowiki><br />
<br />
<nowiki># Use this script from zimbra user </nowiki><br />
<br />
<nowiki># Start of the script </nowiki><br />
<br />
<nowiki># Reference https://wiki.zimbra.com/wiki/ShanxT-LDAP-CheatSheet </nowiki><br />
<br />
source ~/bin/zmshutil<br />
<br />
zmsetvars<br />
<br />
<br />
tmpoutfile=”/tmp/Amit/uidlist.txt”<br />
<br />
rm -vf $tmpoutfile<br />
<br />
<br />
<nowiki>#initially remove any tmp file if exist.</nowiki><br />
<br />
<br />
ldapsearch -x -H $ldap_master_url -D $zimbra_ldap_userdn -w $zimbra_ldap_password -LLL '(&(objectClass=zimbraAccount)(uid=*))' | grep -w uid:> $tmpoutfile<br />
<br />
<br />
<nowiki># Above will list the all uid present in zimbra</nowiki><br />
<br />
<br />
sed -i 's/uid: /uid=/g' $tmpoutfile<br />
<br />
<br />
<nowiki># Above is modifying the ldap search parameter to have the proper input in ldapsearch (replacing uid: by udi=)</nowiki><br />
<br />
<br />
echo "Email_ID's Account_Status Branch" >> $tmpoutfile<br />
<br />
echo "------------------------------------------------" >> $tmpoutfile<br />
<br />
<br />
<nowiki># Below is the starting of the loop which looks from the temprary output file store the values in variable and then have the output accordingly </nowiki><br />
<br />
<br />
for i in `cat $tmpoutfile`<br />
<br />
<br />
do<br />
<br />
<br />
j="(&(objectClass=zimbraAccount)("$i"))"<br />
<br />
<br />
Email_ID=$i<br />
<br />
<br />
Account_Status=`ldapsearch -x -H $ldap_master_url -D $zimbra_ldap_userdn -w $zimbra_ldap_password -LLL $j | grep -w zimbraAccountStatus| cut -d: -f2`<br />
<br />
<br />
Branch=`ldapsearch -x -H $ldap_master_url -D $zimbra_ldap_userdn -w $zimbra_ldap_password -LLL $j | grep -w l:| cut -d: -f2`<br />
<br />
<br />
echo "$Email_ID $Account_Status $Branch ">> $tmpoutfile<br />
<br />
<br />
done<br />
<br />
<nowiki># Script Finished </nowiki></div>Amit Srivastavahttps://wiki.zimbra.com/index.php?title=Ldap_Script_to_get_the_details_in_minimal_time_Amit_Srivastava&diff=60968Ldap Script to get the details in minimal time Amit Srivastava2015-10-02T07:40:23Z<p>Amit Srivastava: Created page with "<center><u>'''''Ldap Script to get the details of user with location parameter'''''</u></center> <center><u>''We can add any parameter to search this will consume few second..."</p>
<hr />
<div><center><u>'''''Ldap Script to get the details of user with location parameter'''''</u></center><br />
<br />
<br />
<center><u>''We can add any parameter to search this will consume few seconds only to search the expected result ''</u></center><br />
<br />
<br />
Script Name: get_list_by_ldap.sh<br />
<br />
<nowiki>#!/bin/bash</nowiki><br />
<br />
<nowiki># Made By Amit Srivastava</nowiki><br />
<br />
<nowiki># Use this script from zimbra user </nowiki><br />
<br />
<nowiki># Start of the script </nowiki><br />
<br />
source ~/bin/zmshutil<br />
<br />
zmsetvars<br />
<br />
<br />
tmpoutfile=”/tmp/Amit/uidlist.txt”<br />
<br />
rm -vf $tmpoutfile<br />
<br />
<br />
<nowiki>#initially remove any tmp file if exist.</nowiki><br />
<br />
<br />
ldapsearch -x -H $ldap_master_url -D $zimbra_ldap_userdn -w $zimbra_ldap_password -LLL '(&(objectClass=zimbraAccount)(uid=*))' | grep -w uid:> $tmpoutfile<br />
<br />
<br />
<nowiki># Above will list the all uid present in zimbra</nowiki><br />
<br />
<br />
sed -i 's/uid: /uid=/g' $tmpoutfile<br />
<br />
<br />
<nowiki># Above is modifying the ldap search parameter to have the proper input in ldapsearch (replacing uid: by udi=)</nowiki><br />
<br />
<br />
echo "Email_ID's Account_Status Branch" >> $tmpoutfile<br />
<br />
echo "------------------------------------------------" >> $tmpoutfile<br />
<br />
<br />
<nowiki># Below is the starting of the loop which looks from the temprary output file store the values in variable and then have the output accordingly </nowiki><br />
<br />
<br />
for i in `cat $tmpoutfile`<br />
<br />
<br />
do<br />
<br />
<br />
j="(&(objectClass=zimbraAccount)("$i"))"<br />
<br />
<br />
Email_ID=$i<br />
<br />
<br />
Account_Status=`ldapsearch -x -H $ldap_master_url -D $zimbra_ldap_userdn -w $zimbra_ldap_password -LLL $j | grep -w zimbraAccountStatus| cut -d: -f2`<br />
<br />
<br />
Branch=`ldapsearch -x -H $ldap_master_url -D $zimbra_ldap_userdn -w $zimbra_ldap_password -LLL $j | grep -w l:| cut -d: -f2`<br />
<br />
<br />
echo "$Email_ID $Account_Status $Branch ">> $tmpoutfile<br />
<br />
<br />
done<br />
<br />
<nowiki># Script Finished </nowiki></div>Amit Srivastava