Sunday, December 25, 2011

Setup and Configure Sendmail Server

Hello Everyone,
After verifying connectivity, DNS, and telnet to smtp, it is right time to configure your Sendmail server. To enable masquerading and binding your domain for sendmail, you should change the sendmail configuration file which is located in /etc/mail/sendmail.mc. Open this file with vi and change the following lines:
change:
LOCAL_DOMAIN(`localhost.localdomain')dnl     to     LOCAL_DOMAIN(khosro.org)dnl
dnl MASQUERADE_AS(`mydomain.com')dnl      to   MASQUERADE_AS(khosro.org)dnl
dnl FEATURE(masquerade_envelope)dnl            to   FEATURE(masquerade_envelope)dnl
dnl FEATURE(masquerade_entire_domain)   to FEATURE(masquerade_entire_domain)dnl
dnl MASQUERADE_DOMAIN(localhost.localdomain)dnl   to MASQUERADE_DOMAIN(khosro.org)dnl

Replace khosro.org with your domain name.
Now, you should run the following command in order to take effect your change in configuration file. You should use m4 command like this:
m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
Now, restart your sendmail with this command:    service sendmail restart
If everything is fine, you should able to send an email. Create a file and put some text on this file. Name this file to message_file. Run this command in order to send an email to your friend.

mail -v -s "Test from Khosro" root@mymachine.khosro.org < message_file

Change mymachine.khosro.org to your machine name and domain name. Use mail command to check the inbox and verify your email that you already sent it.  
Please leave your comments or questions. I will try to answer as soon as possible.
Thanks,
Khosro Taraghi

Exporting all Email Accounts from Zimbra Server for Microsoft Transporter Suite

Hello Everyone,

In order to move all email accounts and data from IMAP or POP3 Zimbra Server in Linux box machine to Exchange Server 2007, we need to create a .CSV file with the following columns:
  • SourceIdentity: The e-mail account that the user has in the IMAP/POP3 Server
  • SourceServer: The name or IP of the IMAP/POP3 Server
  • SourceLoginID: the account user name used to connect on the IMAP/POP3 server
  • SourcePassword: the user’s password
  • TargetIdentity: the Exchange Server 2007 identity will receive the data from the previous IMAP/POP3 Server settings  
To make life easier, I made a script that export all users from Zimbra to a CSV file. 
Here is the script:

#!/bin/bash
clear
echo "Processing account, please wait.............................."
USERS=`su - zimbra -c 'zmprov -l gaa'`
#Assume that domain name is test.com
exchange="@test.com"
echo "SourceIdentity,SourceServer,SourceLoginID,SourcePassword,TargetIdentity" > export_users.csv
for ACCOUNT in $USERS
 do
  SourceIdentity=`echo $ACCOUNT`
  #Assume that domain name is xyz.com for Linux box and Zimbra
  SourceServer=`echo "xyz.com"`
  SourceLoginID=`echo $ACCOUNT | awk -F@ '{print $1}'`
  SourcePassword=`echo "P@ssw0rd"`
  TargetIdentity=`echo -n $ACCOUNT | awk -F@ '{print $1}'`
  TargetIdentity=${TargetIdentity}${exchange}
  if [ $SourceLoginID == "admin" ] || [ $SourceLoginID == "spam" ] || [ $SourceLoginID == "ham" ] || [ $SourceLoginID == "virus-quarantine" ]
  then
   echo "Skipping system account, $ACCOUNT..."
  else
   echo "$SourceIdentity,$SourceServer,$SourceLoginID,$SourcePassword,$TargetIdentity" >> export_users.csv
  fi
 done



Now, we can use this CSV file in Microsoft Transporter Suite to import users to Exchange 2007.
Hope enjoy using this script. Please leave your comments or questions. I will try to answer as soon as possible.
Thanks,
Khosro Taraghi