LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-18-2008, 12:16 AM   #1
yadava
Member
 
Registered: Apr 2008
Posts: 60

Rep: Reputation: 15
Cool sendmail problem


in the sendmail server if we send a mail to any user that mail goes to
/var/spool/mail/somebody directory
how can we change this default path that mail should go in
/var/spool/mail/pcy/
where pcy is a directory and pcy is a user
is it possible that every user has get the mail in there named directory in /var/spool/mail/usernamedirectory
means qqq user should get there mail in /var/spool/mail/qqq/
aaa user should get his mail in /var/spool/mail/aaa/
 
Old 04-18-2008, 12:23 AM   #2
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Your post makes no sense to me. You say that mail currently goes to

/var/spool/mail/somebody

but you want it to go to

/var/spool/mail/qqq/

where qqq is the username. But isn't somebody a username, in which case they are the same thing?

The only difference seems to be the trailing /, but you say that somebody is a directory in any case.
 
Old 04-18-2008, 01:07 AM   #3
BugZRevengE
Member
 
Registered: Oct 2005
Location: Australia
Distribution: Slackware & Kubuntu & CentOS
Posts: 106

Rep: Reputation: 17
I think 'yadava' wants to have their delivery agent deliver to maildir, not mbox format.
Mbox has mail delivered as a single file for a whole mailbox, each messages concatenated onto the end of the list.
Maildir has mail delivered into a folder for a whole mailbox, each message its file.

Mailbox delivery has very little to do with sendmail (a mail transport agent (MTA), and is the responsibility of your mail delivery agent (MDA), such as procmail.

Have a look into your procmail options for this, I have never used maildir for user inboxes.
This link seems useful (I found with a procmail maildir google search - so I've not really gone into it):
http://linuxmafia.com/faq/Mail/procmail-maildir.html

Another thing you will have to be aware of, your imap and pop daemons will need to be aware of the change to, or else your users will not be able to retrieve their mail.

Last thing to note, you might want to look at your filesystem too, the size of inode space is important (you set this when you format), if it is too large you will run out of inodes before you run out of storage, as each message is a single file, often only a few hundred bytes per message, which causes inodes to be used up faster then disk space.

Hope this helps
 
Old 04-18-2008, 02:09 AM   #4
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
I thought of that, but the description of "/var/spool/mail/somebody directory" convinced me otherwise.

if that is the case, good chance to ditch sendmail and move to postfix - that will deliver directly to maildir.

Last edited by billymayday; 04-23-2008 at 12:57 AM.
 
Old 04-18-2008, 03:54 AM   #5
BugZRevengE
Member
 
Registered: Oct 2005
Location: Australia
Distribution: Slackware & Kubuntu & CentOS
Posts: 106

Rep: Reputation: 17
True,
I like procmail -really powerful when you learn it.

If it is just put the mail in /var/spool/mail/$USERNAME/mbox
it should be pretty easy with procmail rules/defaults.

You will have to tell your pop/imap daemons where the inbox lives (I do not think it is a server variables - but could be wrong).

There is probably a way of specifying the inbox directory for postfix too...

I like sendmail, but that is because I have learned it, but postfix is good too and I have started using it on servers that are pretty much just a mail gateway, or have no local mail, but still use sendmail on big installations, mainly because I need to perform some sendmail voodoo at these sites that I have not worked out for postfix.
 
Old 04-22-2008, 11:36 PM   #6
yadava
Member
 
Registered: Apr 2008
Posts: 60

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by yadava View Post
in the sendmail server if we send a mail to any user that mail goes to
/var/spool/mail/somebody directory
how can we change this default path that mail should go in
/var/spool/mail/pcy/
where pcy is a directory and pcy is a user
is it possible that every user has get the mail in there named directory in /var/spool/mail/usernamedirectory
means qqq user should get there mail in /var/spool/mail/qqq/
aaa user should get his mail in /var/spool/mail/aaa/

i mean to say that when we send a mail to someone by default it goes
to /var/spool/mail/ directory
can we change this default path that mail should go somewhare else by using sendmail not by postfix configuration
 
Old 04-23-2008, 12:46 AM   #7
BugZRevengE
Member
 
Registered: Oct 2005
Location: Australia
Distribution: Slackware & Kubuntu & CentOS
Posts: 106

Rep: Reputation: 17
Sendmail does not do local delivery, instead it passes the messages off to the local delivery agent defined in your sendmail.cf file (created by your sendmail.mc file. This is defined with the 'local_procmail' or 'local' feature (from memory and guessing from a configuration we have - I have not played with these files from some time, and not changed the local delivery agent ever).

You are probably using procmail for local delivery, as it is most common with sendmail.

You could define a rule in the global procmail configuration file (usually /etc/procmailrc). This file probably does not exist, unless you have created it, but you can create it, and it will be used. The rule would look something like:
Code:
:0
/var/spool/mail/$USER/`date +%Y%m%d%H%M%S`
this should deliver each message into the $USER folder ($USER is a variable defined as the user who is running the process - and by default procmail runs as the user it is delivering to) as the current date/time of the message (down to the nearest second). It would be possible for two messages to arrive at the same second and be delivered into the one file, so it is not the best...

This link provides some more info on how you could do it, but again, I do not know if it is accurate.
http://linuxmafia.com/faq/Mail/procmail-maildir.html

Again, you need to make sure that any mail services that do client interaction are aware of the change, as sendmail and procmail do not handle pop/imap connections.

You want to test this out in a testing environment, as badly formed procmail rules can loose users mail!
 
Old 04-24-2008, 11:55 PM   #8
yadava
Member
 
Registered: Apr 2008
Posts: 60

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by BugZRevengE View Post
Sendmail does not do local delivery, instead it passes the messages off to the local delivery agent defined in your sendmail.cf file (created by your sendmail.mc file. This is defined with the 'local_procmail' or 'local' feature (from memory and guessing from a configuration we have - I have not played with these files from some time, and not changed the local delivery agent ever).

You are probably using procmail for local delivery, as it is most common with sendmail.

You could define a rule in the global procmail configuration file (usually /etc/procmailrc). This file probably does not exist, unless you have created it, but you can create it, and it will be used. The rule would look something like:
Code:
:0
/var/spool/mail/$USER/`date +%Y%m%d%H%M%S`
this should deliver each message into the $USER folder ($USER is a variable defined as the user who is running the process - and by default procmail runs as the user it is delivering to) as the current date/time of the message (down to the nearest second). It would be possible for two messages to arrive at the same second and be delivered into the one file, so it is not the best...

This link provides some more info on how you could do it, but again, I do not know if it is accurate.
http://linuxmafia.com/faq/Mail/procmail-maildir.html

Again, you need to make sure that any mail services that do client interaction are aware of the change, as sendmail and procmail do not handle pop/imap connections.

You want to test this out in a testing environment, as badly formed procmail rules can loose users mail!

************************************************************************

thanku soooooooooo much
it is working
 
Old 04-25-2008, 06:35 PM   #9
BugZRevengE
Member
 
Registered: Oct 2005
Location: Australia
Distribution: Slackware & Kubuntu & CentOS
Posts: 106

Rep: Reputation: 17
so what rule/setting did you end up using, just for others reference.

The procmail rule I gave, or some settings from the page I linked?
 
Old 04-26-2008, 01:01 AM   #10
yadava
Member
 
Registered: Apr 2008
Posts: 60

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by BugZRevengE View Post
so what rule/setting did you end up using, just for others reference.

The procmail rule I gave, or some settings from the page I linked?
***************************************************************************
from both thing i got my solution
from (/var/spool/mail/$USER)
and also from link i used (DEFAULT=$HOME/Maildir)
thanku so much once again
actually this problem was asked in RHCE examination on 1st april and i have to appear in the examination

Last edited by yadava; 04-26-2008 at 01:05 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
sendmail.mc and sendmail-cf problem. ChrisScott Linux - Software 1 11-26-2006 01:30 PM
Sendmail problem shailesh_jain Linux - Security 3 05-27-2004 01:09 AM
Problem with sendmail juanb Linux - Software 3 01-19-2004 10:26 AM
problem processing sendmail.mc to sendmail.cf ...help... lucastic Linux - Networking 1 09-21-2003 10:08 AM
Sendmail problem: sm-client permissions problem d3funct Linux - Software 0 08-12-2003 05:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:25 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration