Sendmail problems


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Sendmail problems
# 1  
Old 04-19-2010
Sendmail problems

Hello,

This is my first post, so hello!

I'm trying to gather a copy all the mail that goes through my sendmail into a named pipees so I can gather statistics and what not.

I believe a copy of all mail is stored in var/spool/mail?
I tried to replace the mail directory with a named pipe and that messed sendmail up; I'm not sure how sendmail is working b/c there is no record of a mail log anymore.

Anyways, to fix this I tried setting up a .forward file in my home directory with:

/var/spool/mail/eric (i remade the mail directory and gave it write permission; eric is the name of my named pipe)

This isn't working. I'm a noob.

ANY advice would be appreciated. I've been trying to fix this for two days and I can't even get a lead.

Thanks! and let me know how confusing this post was.
# 2  
Old 04-20-2010
You could try forwarding mail to procmail which is a mail filter to make a copy of the mail while the original goes to it's mailbox so you might not get trouble with sendmail cause you don't alter the type of the mail box file. Not sure if it works and procmail get's stuck but maybe worth a try. If it doesn't work, you might want to think about an alternative way like using a special user for those mails and/or using aliases etc.

We use a mechanism like that to split a mail and forward it filtered to different recipients and tools etc. for further processing (in this case munpack, a mime decoder to separate the message from the attachment).
You will need to write a small recipe for procmail which is not hard - there are plenty of How-Tos etc. (Procmail How-To Page).

Here an example:

Push it to procmail:
Code:
$> cat .forward
"|/usr/bin/procmail -f-"

Here is the filter setup:
:0 is the original, :0c are copies...; From and Subject are used as filter; ! in front of the email address means to forward a copy to that user. The pipe hands a copy over to munpack.
Code:
$> cat .procmailrc
MAILDIR=$HOME/in
LOGFILE=$HOME/log/incomming.`date +%y-%m-%d`

:0
* ^From.*thisguy@somedom.com
* ^Subject:.*Here comes your latest data
{
        :0c
        ! another.guy@mydom.com

        :0
        | /usr/local/bin/munpack
}

:0
* ^From.*
/some/tmp/dir

# 3  
Old 04-20-2010
Specifically what statistics are you looking for?
# 4  
Old 04-20-2010
Quote:
Originally Posted by zaxxon
You could try forwarding mail to procmail which is a mail filter to make a copy of the mail while the original goes to it's mailbox so you might not get trouble with sendmail cause you don't alter the type of the mail box file. Not sure if it works and procmail get's stuck but maybe worth a try. If it doesn't work, you might want to think about an alternative way like using a special user for those mails and/or using aliases etc.

We use a mechanism like that to split a mail and forward it filtered to different recipients and tools etc. for further processing (in this case munpack, a mime decoder to separate the message from the attachment).
You will need to write a small recipe for procmail which is not hard - there are plenty of How-Tos etc. (Procmail How-To Page).

Here an example:

Push it to procmail:
Code:
$> cat .forward
"|/usr/bin/procmail -f-"

Here is the filter setup:
:0 is the original, :0c are copies...; From and Subject are used as filter; ! in front of the email address means to forward a copy to that user. The pipe hands a copy over to munpack.
Code:
$> cat .procmailrc
MAILDIR=$HOME/in
LOGFILE=$HOME/log/incomming.`date +%y-%m-%d`
 
:0
* ^From.*thisguy@somedom.com
* ^Subject:.*Here comes your latest data
{
        :0c
        ! another.guy@mydom.com
 
        :0
        | /usr/local/bin/munpack
}
 
:0
* ^From.*
/some/tmp/dir

THANK YOU

---------- Post updated at 10:03 AM ---------- Previous update was at 10:02 AM ----------

Quote:
Originally Posted by methyl
Specifically what statistics are you looking for?
I'm not sure. I'm helping out a fellow superior of mine.

---------- Post updated at 10:59 AM ---------- Previous update was at 10:03 AM ----------

Ok the procmail file is what I need.

I'm running Ubuntu Server 9.1
and sendmail 8.14.3

I have 3 questions about the .procmailrc on my system

1) where is it on my system?
2) do I need to invoke sendmail from the sendmail.mc file?
3) you use a .forward file to invoke sendmail; where should my .forward file be located?

---------- Post updated at 02:49 PM ---------- Previous update was at 10:59 AM ----------

I created a .procmailrc file in /etc

I created a .forward file in /var/mail

I still can't get procmail to forward anything Smilie

Last edited by dadoprso; 04-21-2010 at 02:33 PM..
# 5  
Old 04-21-2010
Quote:
1) where is it on my system?
Issue following:
Code:
which procmail
# if it does not return anything do
dpkg -l procmail| grep ^ii

If both does not return anything, you will have to install it. I guess Ubuntu uses apt or something like Debian. In that case:
Code:
apt-get install procmail

Quote:
2) do I need to invoke sendmail from the sendmail.mc file?
sendmail should be up and running - check for it's process with ps.

Quote:
3) you use a .forward file to invoke sendmail; where should my .forward file be located?
...
I created a .procmailrc file in /etc
I created a .forward file in /var/mail
Both .procmailrc and .forward have to be placed in the home directory of the user you are using.

Edit:
In case this named pipe stuff will still not work, you might want to explain us a bit more in detail, what you are going to do so we can suggest maybe a more appropriate solution.

Last edited by zaxxon; 04-21-2010 at 05:13 AM..
# 6  
Old 04-21-2010
Thank you! I will let you know if this doesn't work, but I think it will!

---------- Post updated at 03:34 PM ---------- Previous update was at 12:33 PM ----------

It worked!

I'm getting mail forwarded to where I want it!

Thank you a million.

New task:
Now I need to figure out how procmail decides to name messages.

Last edited by dadoprso; 04-21-2010 at 06:02 PM..
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Problems host name lookup failure sendmail

Hi I have a problem in sendmail Freebsd when sending emails to yahoo as an example, I get: Sep 5 10:05:43 local50 sm-mta: STARTTLS=client, error: connect failed=-1, SSL_error=1, errno=0, retry=-1 Sep 5 10:05:43 local50 sm-mta: STARTTLS=client: 43926:error:1407742E:SSL... (3 Replies)
Discussion started by: rickyarge92
3 Replies

2. HP-UX

Sendmail problems

I running sendmail as user smmsp I have create user,group with same name Sendmail start ok,but when i try to send email outside of localhost give me this error Jan 3 20:46:59 hpux2 sm-mta: t03JkwJb020892: t03JkxJb020893: DSN: Insufficient permissionI give those permissions chmod 2755 ... (1 Reply)
Discussion started by: Linusolaradm1
1 Replies

3. UNIX for Dummies Questions & Answers

Problems with Sendmail AUTH and TLS

Greetings. I desperately need help to get my sendmail configuration working again. I followed this guide: Unmemorable Memories » Blog Archive » Enabling SMTP-AUTH for Sendmail on Debian Linux 3.1 to enable TLS and AUTH in sendmail and now I get an error I just cannot find any information... (1 Reply)
Discussion started by: Mr.Glaurung
1 Replies

4. UNIX for Dummies Questions & Answers

Sendmail dir permission problems.

I accidently deleted the queue directory and now i'm receiving this error when I try to send email with sendmail. :~# mailq MSP Queue status... /var/spool/mqueue-client (1 request) -----Q-ID----- --Size-- -----Q-Time----- ------------Sender/Recipient----------- s495xA7J002673 ... (1 Reply)
Discussion started by: galford
1 Replies

5. AIX

Problems with sendmail on AIX

hi, i got this error, i have no idea where to start.. anyone please??? Warning: .cf file is out of date: sendmail AIX5.3/8.13.4 supports version 10, .c f file is version 9 WARNING: local host name (BAANPRO) is not qualified; see cf/README: WHO AM I? Running /var/spool/mqueue/o3CBj3np1138768... (3 Replies)
Discussion started by: fdeivis
3 Replies

6. Shell Programming and Scripting

Command line problems with sendmail

I cannot get this shell script to work. The path to sendmail is correct... #!/bin/bash echo -e "Subject: email subject\n\nemailbody" | /usr/sbin/sendmail -F fromemail@somedomain.com -t recipientemail@somedomain.com (1 Reply)
Discussion started by: limmer
1 Replies

7. UNIX for Advanced & Expert Users

Sendmail problems -- with sending mail

Hello, I am C. and I would like to send mail with Sendmail to my hotmail-account. But this doesn't work, the mail always returns in the file: /var/spool/mail/root. Probably there is something wrong with my SmartHost. I configured it like: define ( 'SMART_HOST','smtp.direct-adsl.be') -->... (1 Reply)
Discussion started by: caroline
1 Replies

8. UNIX for Dummies Questions & Answers

Sendmail problems

Hi, I have some problems w/ the sendmail. I see that messages are queued in the /var/spool/mqueue and they are never sent to the recipients. This problem just suddenly started without any modifications in the current configuration. I already started and stop the sendmail and it did not help.... (1 Reply)
Discussion started by: ktanya
1 Replies

9. UNIX for Dummies Questions & Answers

sendmail problems - no man pages

Hi all, I have a virtual dedicated unix server somewhere (not sure we can put names, so ain't putting it yet :p) anyway, I have problems using sendmail, but before I am asking for help, I don't get ANY manpages for sendmail on my machine. I would like to try and solve this on my own (the... (2 Replies)
Discussion started by: saariko
2 Replies

10. UNIX for Dummies Questions & Answers

Sendmail configuration problems

First of all, Happy Holidays,Merry Xmas, Happy Hanakah, Happy Kwanzaa, Happy Mid Winter Festival, etc.(Forgive me if I left your holiday out) Anyway, here is my situation. I am setting up an email server at the job, and Sendmail is not cooperating. The error that I get on my RedHat 7.3 Dell... (5 Replies)
Discussion started by: Jody
5 Replies
Login or Register to Ask a Question