LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 11-19-2004, 02:15 PM   #1
kevinm2
Member
 
Registered: Aug 2004
Distribution: Redhat 7.2
Posts: 73

Rep: Reputation: 15
Sendmail / pop3 Question


Any leads on how to setup a RedHat 7.2, running sendmail 8.12 and pop3 to be a mail server for two different domain names with different users. Help is greatly appreciated.
 
Old 11-30-2004, 01:11 PM   #2
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
Yup, setup virtual domains or users, etc. Your probably better off reading up on sendmail, it can be a beast to configure and I recommend reading up on it to get any type of grasps on it.
 
Old 12-01-2004, 02:30 AM   #3
twantrd
Senior Member
 
Registered: Nov 2002
Location: CA
Distribution: redhat 7.3
Posts: 1,440

Rep: Reputation: 52
Or try exim. Much much easier to configure and maintain.

-twantrd
 
Old 12-01-2004, 03:22 AM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
If the users are different (i.e. if you are not going to have user1@domain1.com and user1@domain2.com) the just add the 2 domainnames in /etc/mail/local-host-names
 
Old 12-01-2004, 05:56 AM   #5
kava_kicks
LQ Newbie
 
Registered: Nov 2004
Distribution: Fedora Core 4
Posts: 16

Rep: Reputation: 0
This is a script I wrote to do it all with a single command. - though it assumes you have already added the new domain to to Sendmail's local host names.

To do this first step:
cd /etc/mail/
pico local-host-names
Add a line to /etc/mail/local-host-names with the value of your domain name.
This tells sendmail what domains it responds to as local. In other words, mail to these domains will be delivered to local users if they exist or bounced if they don't exist.

You put this script in the bin directory of your home directory (from memory), then create a symbolic link to it so that you can run it from anywhere ... can't remember where the hell I put the symbolic link ... (it was my first script)


# addmail.sh - Adds new email address
#####################################
# Takes 3 compulsory options: email address, password and system username

# Define the usage statement as a variable
usage="USAGE: addmail -e email -p password -u username"

# The correct number of positional parameters is 6 (3 options & 3 arguments)
# Check the number of positional parameters and exit if incorrect
nopt=$#
if [ ${nopt} -ne 6 ]
then
echo "ERROR: Incorrect number of positional parameters"
echo "${usage}"
exit 1
fi

# As getopts peels the command line options off, it stores them in variable opt
# Use opt as the test value in the case statement
# For each option, assign the arguments passed ($OPTARG) to a variable
# Define a default case that prints usage and exits if invalid options are used
while getopts ":e:u:" opt;
do
case $opt in
e ) eopt=$OPTARG ;;
p ) popt=$OPTARG ;;
u ) uopt=$OPTARG ;;
\? ) echo ${usage}
exit 1
esac
done

# Check whether the Virtusertable file has been backed up already today.
# If it has not been backed up, then back it up using today's date
today=$(date --iso-8601)
if [ ! -e /etc/mail/virtusertable.${today} ]; then
cp /etc/mail/virtusertable /etc/mail/virtusertable.${today}
fi

# Create the user and re-enter the password (-p sometimes fails)
# Change the permissions on the mailbox and add the user to the virtusertable
# Then make the mail file, restart sendmail and print out the user details
# Use the options passed to the addmail script
# Only execute each command if the proceeding command completed successfully
adduser -g mail -d /home/${uopt} ${uopt} &&
echo "${popt}" | passwd --stdin ${uopt} &&
chown -R ${uopt}.mail /home/${uopt} &&
echo "${eopt}"$'\t'"${uopt}" >> /etc/mail/virtusertable &&
make -C /etc/mail &&
/etc/rc.d/init.d/sendmail restart

echo "Email: ${eopt:-"Did not use option -e"}"
echo "Password: ${popt:-"Did not use option -p"}"
echo "Username: ${uopt:-"Did not use option -u"}"
 
Old 12-01-2004, 06:00 AM   #6
kava_kicks
LQ Newbie
 
Registered: Nov 2004
Distribution: Fedora Core 4
Posts: 16

Rep: Reputation: 0
woops .. smiley face screwed the script, that line should read

while getopts ":e: p :u:" opt;

but without the spaces in front and behnd the p
 
Old 12-01-2004, 11:30 AM   #7
kevinm2
Member
 
Registered: Aug 2004
Distribution: Redhat 7.2
Posts: 73

Original Poster
Rep: Reputation: 15
Thanks Kava_kicks, What exactly does the script do?

As per trickykid's recommendation, I did some readings and got sendmail to work for domain1.com and domain2.com. But as we all know, the problem is when you have joe@domain1.com and another person named joe@domain2.com. Would your script solve that problem? -- Kevin
 
Old 12-03-2004, 05:37 AM   #8
kava_kicks
LQ Newbie
 
Registered: Nov 2004
Distribution: Fedora Core 4
Posts: 16

Rep: Reputation: 0
Hi,

My script just makes it easier to add email addresses, by combining 4 or 5 commands into a single command.

My script will not directly solve the problem you are having, but the problem is easy to solve anyway.

All you need to do is set up the system users with unique names.

The easiest way to do this is to create the following two users:
domain2_joe and domain1_joe

In otherwords, domainname_username (reverse of their email address essentially).

The only problem I have had with this method is that there seems to be a limit to the size of a system accounts length.

So, if you have joe@reallyreallylongdomainname.com .... you may find the username truncated.

The benefit of doing it this way is that all of your users will be grouped by domain. So if you decide to delete a domain and all associated accounts, you can just delete all users that have the name domain_***

This should fix your issue nicely.
 
Old 12-03-2004, 11:18 AM   #9
kevinm2
Member
 
Registered: Aug 2004
Distribution: Redhat 7.2
Posts: 73

Original Poster
Rep: Reputation: 15
Thanks again for your prompt reply. If you would kindly respond; There are two question left for me.

1- Would the user be a regular system user or pop only user?

2- When you say
Quote:
The easiest way to do this is to create the following two users:
domain2_joe and domain1_joe
would their e-mail address be domain2_joe@domain2.com and domain1_joe@domain1.com? Or there is a way to make their e-mail addresses joe@domain2.com and joe@domain1.com?
 
Old 12-22-2004, 05:48 AM   #10
kava_kicks
LQ Newbie
 
Registered: Nov 2004
Distribution: Fedora Core 4
Posts: 16

Rep: Reputation: 0
Email ///

1- Would the user be a regular system user or pop only user?
- The user would be a pop only user (though this depends on hwo your groups are set up...something I didi not include in my script and which I did not set up in the first place)

2- would their e-mail address be domain2_joe@domain2.com and domain1_joe@domain1.com? Or there is a way to make their e-mail addresses joe@domain2.com and joe@domain1.com?
- There email addresses would be joe@domain2.com and joe@domain1.com, but their system usernames would be domain2_joe@domain2.com and domain1_joe@domain1.com. In the virtusertable, they would look like this:
joe@domain2.com domain2_joe
joe@domain1.com domain1_joe
 
Old 12-22-2004, 11:31 AM   #11
kevinm2
Member
 
Registered: Aug 2004
Distribution: Redhat 7.2
Posts: 73

Original Poster
Rep: Reputation: 15
Thank you.
 
Old 12-23-2004, 03:50 PM   #12
kava_kicks
LQ Newbie
 
Registered: Nov 2004
Distribution: Fedora Core 4
Posts: 16

Rep: Reputation: 0
No problem
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Sendmail POP3 Issues (SW 10.2) gmgartner Slackware 1 11-01-2005 07:13 PM
pop3 and sendmail Thrasher Linux - Software 2 05-30-2004 02:08 PM
SENDMAIL, POP3 et al robbiemorgan Linux - Newbie 2 08-14-2003 01:30 PM
sendmail (pop3 receive?) mtucker6784 Linux - Networking 1 07-03-2003 07:53 AM
Sendmail/pop3 nkirk Linux - Newbie 5 04-12-2002 02:53 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:04 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration