# sendmail problems

## onineko

Hello!

I'm trying to set up a mailserver, and since I now some very well, who uses sendmail, I decided for that (so that I don't have to annoy forums whenever I run into problems later on^^)

BUT, this person is on an extenden vacation and I'm trying to set up sendmail now! ^^;

Now, I already googled and searched this forum, but I was unable to find a howto that would help me in setting up sendmail!

Eister it's postfix or anything other, or it's for other linux-distributions and the files are different (e.G. I thought this here http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch21_:_Configuring_Linux_Mail_Servers#Linux sounded rather good, but I already failed at locating the make-file for sendmail.mc! ^^; )

Is there anyone here, who can point me in the right direction? This is my first try at setting up any mailserver, so I really do need help...^^;Last edited by onineko on Thu Aug 17, 2006 2:19 pm; edited 1 time in total

----------

## Sedrik

Well it's not sendmail but have a look at the wikisite http://gentoo-wiki.com/HOWTO_Linux_Virtual_Hosting_Server

----------

## onineko

thank you for the link, I looked at it, but It really is a bit overblown for my purposes.^^;

Is there anyone, who can give me a hint, where to look for a usable, small-scale sendmail-howto? somehow all I find is postfix etc and usually also  to extreme for my humble purposes^^

(It's not like I I have to keep track of dozens of domains and users! I'd be quite happy to set up sendmail for 1 to a couple of users on 1 dyndns.org domain...^^)

----------

## Sedrik

Turns out that postfix is the way to go since it is moresecure. Check this small thread out, http://www.linuxquestions.org/questions/showthread.php?t=13849

*Edit

Here are some more stuff you migth be interested in.

http://www.brennan.id.au/12-Sendmail_Server.html

----------

## jamapii

20 years ago, everyone wrote a sendmail.cf file... look at it   :Laughing:   Even I once wrote some code for this.

Now, you have sendmail.mc and submit.mc, and create *.cf from them:

```
m4 sendmail.mc > sendmail.cf
```

For the rest, file:/usr/share/doc/sendmail-8.13.7-r1 can be a good starting point, but useful information is hard to find, 90% deals with compiling sendmail and modifying sendmail.cf

----------

## pteppic

For simple startup, Webmin has most of the configuration options you are going to need in it's sendmail module. Just emerge webmin, /etc/init.d/webmin start, point your browser to https://localhost:10000 and select sendmail. You have to set the module config up properly (point it towards the config files and sendmail executable) but other than that it's an easy way to start building the config, and when you are more advanced it can still help build the sendmail.cf for you without messing around with the m4 command.

NOTE: DO NOT use a virtusertable for site a blackhole, it just complicates things later.

While we are on the subject, what's the deal with postfix, is it better or are people just too lazy to configure sendmail nowadays?

----------

## onineko

thanks for the answers!

after I tended to some problems (update world vs php, mysql and apache^^)  I'm currently fighting my way through sendmail/procmail/pine ^^;

Now, I'm really quite the n00b and having some problems.

currently, my sendmail.mc looks like that:

 *Quote:*   

> 
> 
> divert(-1)
> 
> divert(0)
> ...

 

then I did a m4 sendmail.mc > sendmail.cf, so the sendmail.cf looks like that:

 *Quote:*   

> 
> 
> VERSIONID($Id: sendmail-procmail.mc,v 1.2 2004/12/07 01:59:31 g2boojum Exp $)
> 
> OSTYPE(linux)
> ...

 

and the /etc/hosts file reads

 *Quote:*   

> 
> 
> 127.0.0.1       localhost.blabla.dyndns.org     localhost
> 
> 192.168.0.1     arcadia.blabla.dyndns.org       arcadia
> ...

 

in aliases i put in the names I might want to use for emailadresses as aliases for my standard-user, so that they end up in his mailbox (when I create one, I'm still a bit hazy on which programm i'll used for that, sendmail, procmail or pine?), otherwise I left it untouched, just copied the file to where sendmail wants it.

I mean, I get the general principle of mta, mua and mda, but where do I have to create an account in which way and all that? currentlly I'm just poking sendmail, but later I'll have to get them all to work together, so that I can send and receive mail, and I'm quite at a loss as to the how of this..^^;

in the access-file I have 

 *Quote:*   

> 
> 
> localhost.localdomain     RELAY
> 
> localhost                 RELAY
> ...

 

when I try sendmail -v someone@domain.net (just as an example-address^^), this is what I get:

 *Quote:*   

> 
> 
> testtest
> 
> .
> ...

 

to be honest, somewhere in this, I lost the overview of what should go where and what is supposed to do what, using whatever as basis..^^;

additionally, there is no log-file to be found, although sendmail is running...do I have to enable logging specifically or why is there no /etc/var/maillog?

can anyone help me, by giving me an overview, of what is supposed to do what, is rsponsible for what and needs what to be written where?

also, thanks for the hint about webmin, but I'm trying to get it to work with simple config-file-writing(trying to learn it the heavy metal way, or somesuch..^^; )

----------

## outspoken

 *onineko wrote:*   

> 
> 
> to be honest, somewhere in this, I lost the overview of what should go where and what is supposed to do what, using whatever as basis..^^;
> 
> additionally, there is no log-file to be found, although sendmail is running...do I have to enable logging specifically or why is there no /etc/var/maillog?
> ...

 

your log should be in /var/log/maillog

deferred connection refused typically means there is no server listening on the host. make sure sendmail the server is running. ps auxww | grep sendmail or /etc/init.d/sendmail restart just to make sure it is running.

----------

## onineko

well, that is the problem, I already knew where the log is supposed to be, but it isn't there!

Also, locate maillog turned up emptyhanded.

ps -auxww gave me 

 *Quote:*   

> 
> 
> smmsp 10221  0.0  2.6  5600   2428   ?         Ss   Aug14   0:00   sendmail:Queue runner@00:30:00 for /var/spool/clientmqueue
> 
> root       13643  0.0  0.5  1456     464   pts/1   R+  19:39   0:00   grep --colour=auto sendmail
> ...

 

so, where am I to start?

It really freaks me out, that there's no logfile and I'm still at a loss to the "what needs to go where for what..." ^^;

----------

## onineko

ok, I checked again:

 *Quote:*   

> 
> 
> arcadia skaa # ps -A | grep sendmail
> 
> 10221 ?        00:00:00 sendmail
> ...

 

so: there is no maillog, the server seems to be running, but I can't even pretend to send a mail....where am I to search for the cause? ^^;

(all the config-files are still as posted above, nothing was done concerning procmail or pine, they are simply emerged)

----------

## pteppic

You need to include your /usr/share/sendmail-cf/m4/cf.m4 file in the sendmail.mc config.

----------

## onineko

thank you for the hint, unfortunately it only made things more confusing for me..^^;

when I add include(`/usr/share/sendmail-cf/m4/cf.m4') to sendmail.mc, this is the message I get when trying to m4 it to sendmail.cf

[quote ]

*** ERROR: No system type defined (use OSTYPE macro)

[/quote]

except for the added include-line, I changed nothing on the sendmail.mc postet above, and there obviously is the OSTYPE specified! What is going on here?? ^^;;

----------

## pteppic

Ok, this is a working sendmail.mc for local mail delivery, with 'catch-all' pointing to root, and procmail for local delivery

```
divert(-1)

divert(0)dnl

include(`/usr/share/sendmail-cf/m4/cf.m4')dnl

VERSIONID(`$Id: sendmail-procmail.mc,v 1.2 2004/12/07 01:59:31 g2boojum Exp $')dnl

OSTYPE(linux)dnl

DOMAIN(generic)dnl

define(`LUSER_RELAY',``local:root'')

FEATURE(`smrsh',`/usr/sbin/smrsh')dnl

FEATURE(`local_lmtp',`/usr/sbin/mail.local')dnl

FEATURE(`local_procmail')dnl

MAILER(local)dnl

MAILER(smtp)dnl

MAILER(procmail)dnl

```

Make sure that will work, then start to add more options.

The fact you are getting connection refused usually means that sendmail daemon isn't running.

You can try to run the daemon by hand

```
source /etc/conf.d/sendmail

sendmail -v $SENDMAIL_OPTS 
```

 and check the outputs. Your clientmqueue is running ok.

BTW, sendmail.cf should be mostly uninteligable, apart from the comments, try grep -v "#" /etc/mail/sendmail.cf, if it makes sense to *you*, it's wrong.

----------

## onineko

thank you very much, using you file, I can indeed send mail! =)

now, currently, the mail I send has as sender username@hostname.FQDN

as far as I know, with FEATURE (`relay_entire_domain')dnl one can make sure, only user@FQDN is seen as sender, but when I put this line in, I got the error 

 *Quote:*   

> m4 sendmail.mc > sendmail.cf
> 
> sendmail.mc:11: m4: Cannot open /usr/share/sendmail-cf/feature/.m4: No such file or directory
> 
> 

 

the sendmail.mc now looks like that:

 *Quote:*   

> 
> 
> divert(-1)
> 
> divert(0)dnl
> ...

 

?_? why is it reading the include wrong?

----------

## onineko

sry, problem already solved, instead of the Feature relay entire domain, I put in 

MASQUERADE_AS(`FQDN')dnl

FEATURE(`masquerade_envelope')dnl

an now I'm getting the testmail from username@FQDN =)

Now to start testing the other optional stuff, let's see into what kinds of problems I'll run there! =)

----------

## onineko

ok, not directly sndmail-related I guess, but, how can I give the standard-user the right to use sendmail?

I did the config-modding and related testing as root, and now the standard-user can't even sendmail, getting the error: bash: unknown command?

I don't intend to always use sendmail email@adress.com as the command, but Id like to test it that way...

also, I intended to use pine as default for the user that wants to send emails.

But the end-goal is, to get squirrelmail up and running, so that I can comfortably mail from anywhere and all that...

I guess for this I need pine working the right way for the standard-user?

----------

## onineko

ok, this may be a stuoid question, but is there anything special I have to do, to be able to receive mail, as well as send?

I can send mail just fine, but when I answer to them from my gmail-adress I get nothinmg in my pine-inbox..?

Instead I get an error in gmail, reading

 *Quote:*   

> 
> 
> This is an automatically generated Delivery Status Notification
> 
> Delivery to the following recipient failed permanently:
> ...

 

yeah, I changed the quote, so that instead of the real values there is now <username>, hostname, FQDN ...

any ideas where I'm going wrong in trying to receive mail? ^^;;

----------

## pteppic

Erm, yeah, you have to tell sendmail which domains it will accept mail for, as well as masquerade as. 

Damn, my sendmail has worked with the same config for sooo long..... add the domains you wish sendmail to accept mail for to the /etc/mail/local-host-names file.

As for sending mail as a user, you can, you just can't see the command, try /usr/sbin/sendmail or add /usr/sbin to your $PATH.

----------

## onineko

thank you very much! I put the FQDN in the /etc/mail/local-host-names, and I don't get the error anymore, but the user is still receiving no mail...? what might be the cause of this? 

thanks for the path-hint, the standarduser will use pine anyways, so there's no need for direct sendmail access anyways =)

----------

## onineko

ok, I'm still missing the maillog-file, it's nowhere to be found.

How can I get me a log for my sendmail??

I'm having the problem, that I'm able to send, but not to receive mail.

There is no error at sender side, when I try to send email to the adress anymore, since I put the FQDN in the local-host-names, so a log would really come in handy now (beside the fact that a log has its use at anytime!)

I'm using Pine, If that might be any help to the knowledgeable..^^;

my sendmail.mc looks currently like that:

 *Quote:*   

> 
> 
> divert(-1)
> 
> divert(0)dnl
> ...

 

has anyone any hint what might be the cause for this problem?

my guess would be, that maybe I have to put some configs in procmail, but that's as far as it goes^^;

----------

## pteppic

You may have a ~/procmail.log for each user (I believe this is the default for gentoo)

Your syslog(-ng) has to be setup to filter mail messages into seperate log files, this may be why they are missing.

I wouldn't trust any mail reader at this stage personally, run 

```
while true;do ls -l ~/.maildir/new;sleep 5;done
```

 for a specific user, then send them mail and watch it turn up (hopefully).

Once this is working use pine to check where they are coming from (though personally, I've had no luck with pine and .maildir, I use mutt for simplicity)

----------

## onineko

thank you again for your help. I've found no procmail.log so far, and wasn't yet able to try your check for mails, but I'll try it in the morning and hopefullly that will give some helpful info abou the state of my mailserver and all =)

----------

## onineko

ok, I actually might be getting somewhere! =)

your little command-string gave me the location /home/skaa/.maildir/new in which a bunch of messages was just laying around! ^^

Now, when I tried to tell pine in the setup, which folder to look in, it told me, it couldn't open the folder because it wasn't a selectable folder?? wtf? do I have to use some procmail-tricks here? what is a selectable folder? *confused* ^^;

unfortunately, there is still neither a maillog nor a procmail.log...I'm really getting confused and worried about this lack of logs...? ^^;

----------

## onineko

it seems to be a maildir-problem, as pine is not a friend of .maildir...

so I set the procmailtc from reading 

 *Quote:*   

> # Use maildir-style mailbox in user's home directory
> 
> DEFAULT=$HOME/.maildir/

 

to

 *Quote:*   

> 
> 
> # set procmail config file directory
> 
> PMDIR=/etc/procmail
> ...

 

but I still don't know, how to tell pine, where to look for its mail (and I'm a bit in a hurry right now^^)

the rc.general reads

 *Quote:*   

> 
> 
> :0
> 
> * ^TO_<myusername@FQDN_in_right_spelling
> ...

 

....what can else can be done? ^^;;

----------

## pteppic

Either:

1) Change /etc/procmailrc back to the default, and either symlink ~/.maildir to ~/Maildir, or set 'maildir-location=~/.maildir' in your .pinerc

or

2) Set /etc/promailrc to 'DEFAULT=$HOME/Maildir/'

Then pine will work 'out of the box' (well,as well as it does with the .maildir format)

Changing where your mail is put will just cause headaches later when you setup an imap server.

----------

## onineko

hm, how would I tell pine, not to use .maildir (as it seems a bit uneasy with it) but to use mbox or to simply use some designated folder?

(and what's the difference between the three: just the name of the folder, or what?)

And why do I later get problems with an imap-server, when I just tell the programm in which folder the mails go?

(will try the advice now and give feedback later, thanks for the help, again^^)

----------

## onineko

ok, now for an update =)

unfortunately, your advice didn't work for me, so I tried it as described in http://www.gentoo.org/doc/de/guide-to-mutt.xml.

now I renamed the /etc/procmailrc so it won't be used and created /home/username/.procmailrc:

 *Quote:*   

> 
> 
> MAILDIR=$HOME/Mail
> 
> LOGFILE=$HOME/.procmaillog
> ...

 

however, this didn't help either.

there is still no log and no new mails to be found.

(I'm currently looking for them with locate *.hostname, as they are usually named <some crazed number>.hostname and I'm trying to get rid of this bloody .maildir crap)

also, there is no pine.conf on my system, only the /home/username/.pinerc

Is this in any way significant, especially in connection with the persistent lack of any logfiles for either sendmail or procmail?

as I wasn't sure if it's needed, I restartet sendmail, just in case.

Where is now the trouble, is it with pine or procmail or both? What can I do, to get logfiles? not to mention receive mail?^^; (sending still works fine^^)

Also, will I have to make any tremendous changes, when I install squirrel? after all, the point is to later be able to use a comfy web-gui for handling my mail (and maybe get the windows pc in my home-network to download the mails from my server..)

----------

## onineko

ok, short update; for a while there, I got a "TEMP_FAILURE: Could not initiate SMTP conversation with any hosts:"-error, but I already did a portforwad add for port 25, so that can't be the problem anymore, can it? any hints, what else I might try to kick procmail/pine into doing my bidding? ^^;

----------

## nendzd

I'm having issues with sendmail also which is how I stumbled onto this topic..

it looks like sendmail defaults to logging to /var/log/messages.. at least thats where I'm seeing everything show up when it sends a message out.

As to my issue, it seems to be on the receiver end, as sendmail shows that delivery was accepted.. Im betting they think it's spam mail and as such they don't forward it to the person..

Anyways, just wanted to chime in where it's logging everything for me.

----------

## onineko

thank you very much, somehow I never thought of looking in messages, which is where I found the logging of sending =)

Best of luck for your receiving problem, as I have my own and am getting a bit troubled by it ^^;

Unfortunately, there is absolutely no reaction in /var/log/messages, when it should receive mail...I'm really wondering..does this mean, it doesn't even arrive? that wouldn't really make sense...?_?

do you have a working procmaillog? maybe there could be something helpful..

as readable somwehere up there, I told it where to log, using an example from a gentoo-howto, so that should work, but somehow...it just doesn't in this case..;_;

----------

## onineko

ah, I just reread your post about the problem being on the receiving side, now I get it ^^;

It is quite likely, actually, as many providers don't accept mail/smtp-connections from adresses that are listed as dynamic. If you want to check this, try a sendmail -v <address that has the problem>

the procedere can be found further up in this thread. 

I now from experience, that gmail works while gmx doesn't.

----------

## nendzd

 *onineko wrote:*   

> ah, I just reread your post about the problem being on the receiving side, now I get it ^^;
> 
> It is quite likely, actually, as many providers don't accept mail/smtp-connections from adresses that are listed as dynamic. If you want to check this, try a sendmail -v <address that has the problem>
> 
> the procedere can be found further up in this thread. 
> ...

 

Hah.. thanks for that.. it looks like my provider, comcast.. is blocking email to comcast because it's coming from a comcast ip address.. I think

```
050 >>> MAIL From:<root@dave-linux.shadetree> SIZE=307

050 550-[my intraweb ip goes here] blocked by ldap:ou=rblmx,dc=comcast,dc=net

050 550 Comcast.net subscribers are not permitted to directly connect to this mail server. If you are a Comcast Commercial Services customer and need support, please contact support_biz@cable.comcast.com

050 <root@dave-linux.shadetree>... Connecting to local...

050 <root@dave-linux.shadetree>... Sent

```

----------

## pteppic

do you recieve mail if you send to yourself from the server i.e. sendmail $USER && sleep 5 && cat /home/$USER/.maildir/new/*

----------

## onineko

well, I for one dont receive mail when I try your command-chain, but then, my /home/<username>/.procmailrc reads:

(so any looking in .maildir is bound to be fruitless^^)

 *Quote:*   

> 
> 
> MAILDIR=$HOME/Mail
> 
> LOGFILE=$HOME/.procmaillog
> ...

 

Just now I found out: when I retried sending to a .gmx.net-adress, a .procmaillog was created. It logged, that the message could not be sent (because gmx doesn't accept it), informing the user. The message was in the default-"folder".

Pine accepted the folder when I gave it as inbox-address.

BUT, when I sent a mail from gmail, nothing happened. So it would seem, only "local" mails get to the right address? Where am I to look for the mistake now? ^^;;

As I mentioned, port 25 should be free (portforwarding is enabled) and sendmail gives no output at all in /var/log/messages after I answer an email from my server (of wich the sending was logged just fine) ?_?

----------

## pteppic

To test for recieving mail:

1) Use sendmail on the server, sendmail <user>  -this will test the delivery method

2) Use sendmail on another machine inside the lan sendmail <user>@<host>  - this makes sure sendmail is listening on more than just localhost

3) Go here, just fill your public ip and click the test button- this proves the firewall is ok

4) Do the same as step 3 but use the real FQDN

----------

## onineko

ok, for 1)

 *Quote:*   

> 
> 
> sendmail -v skaa
> 
> localer test
> ...

 

this mal was received and also landed in the default-folder, readable with pine

for 2)

I won't be able to test this, since the boxes in my home-lan are Windows =/

and somehow I doubt, that CD-distributions like Knoppix run sendmail...

for 3) and 4)

This host was recently tested with an anonymous test.

The host couldn't be reached for testing.

(the first test -IP- was negative, but I forgot the exact worlds)

----------

## onineko

thank you again for the help, btw^^;

I just remebered another way of testing ->pingability.com gave me:

 *Quote:*   

> 
> 
> Information	You have 2 mail servers listed for your domain.
> 
> Mail Server: <FQDN>
> ...

 

quite obviously the problem is that there seems to be no way to connect to the mailerver from outside..now for the how and why and what to do about it..^^;;

Also, afaik I have to use IMAP for squirrelmail to have a purpose later on...where would I start with that?^^;

----------

## onineko

hm, I'm thinking, this a dns-problem?

I went over my dns-files again, using the advice from this howto: http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch21_:_Configuring_Linux_Mail_Servers#Linux

but when I change my /etc/hosts the way they want, Pine whines about bad domain-info and the from-address is wrong (only the hostname)

so, now my dns-info file read:

/etc/resolv.conf

 *Quote:*   

> 
> 
> domainserver <FQDN>
> 
> nameserver 213.148.129.10
> ...

 

/etc/hosts

 *Quote:*   

> 
> 
> 127.0.0.1       localhost.<FQDN>     localhost
> 
> 192.168.0.1     <hostname>.<FQDN>       <hostname>
> ...

 

the howto seemed to want me to write the first line as 

127.0.0.1      <hostname>.<FQDN>         localhost.localdomain     localhost      <hostname>

but then I get said problem with pine, and I don't see, why I should put the hostname instead of localhost *confused*

I have no domain in my local lan, so I left that out anyways.

Ok, i see a problem, 192.168.0.1 is set as <hostname>.FQDN, but this is only usable in my home-lan.

But then how would I put it right? the nic that is connected to the internet should be declared here, so that it can be used in delivering/receiving mail, right? but how?

?_? gah, now I'm confused abou the whole, what needs what as dns-info again 

(when I say host <FQDN> i get a right answer, it even mentiones mailservers at 5 and 10, but host <hostname>.<FQDN> only ends in error)

----------

## pteppic

Do you have wildcard entries in real world dns for your FQDN?

Sounds like you need more dns records, do you run a .local dns server?

----------

## onineko

I must admit, I'm not really able to answer your question^^;

my FQDN is registered with dyndns.org, the website on this server is easily reachable and works just fine. As far as I know, I don't have any wildcard entries, but then, I just gave me the exact definition of wildcard entries in wikipedia a minute ago^^; 

And to say it in the dumbest way imaginable: As far as I know, I'm not running a .local dns server...^^;

hm, I'm pretty sure it has nothing to do with the mail-receiving problem, but I was surprised to see a dhcpd running, when there is no dhcp at work in my local network...*sight* will have to poke that one, some other time...-_-;

----------

