# Sendmail crapped out



## kutu62 (Apr 28, 2010)

On April 20th my cron emails stopped coming to me which is odd because all I do it play with php and html in my http doc root. So I never touched sendmail.

When I run "top" from the cli I notice that sendmail is in the paused "STATE" - how do I un pause? 

I find no errors for sendmail in var/log - not even a log file for sendmail.
I try to restart or stop and start sendmail with command "sendmail stop" etc and it just hangs in the foreground.

How can I troubleshoot this better?

Many thanks


----------



## crsd (Apr 28, 2010)

Check /var/log/maillog.


----------



## DutchDaemon (Apr 28, 2010)

[cmd=]sendmail stop[/cmd] is not a valid command. Try [cmd=]/etc/rc.d/sendmail stop[/cmd] or [cmd=]/etc/rc.d/sendmail restart[/cmd]. 

If you're only running Sendmail as a local MTA (not listening on a port other than localhost) you may expect an error (containing phrases like 'onestart' of 'forcestart'), but it can be ignored. 

If Sendmail won't die, you can try  or [cmd=]kill -9 `cat /var/run/sendmail.pid`[/cmd] or [cmd=]killall -9 sendmail[/cmd]. 

This can be followed by [cmd=]/etc/rc.d/sendmail start[/cmd] to resume normal operations.


----------



## kutu62 (Apr 28, 2010)

Thanks DD

Okay so sendmail is started but still not working.

First I added send mail to /etc/rc.conf

```
sendmail_enable="YES"
```

Then started sendmail as you told me
Now when I issue "top" the state of sendmail is "select"

I now try to test sendmail like this:

```
mail user@domain.com
Subject: For Testing Only
This email is for testing the mail delivery system only.
ctrl+D
```

mail seems to send but it never hits destination - I tried two different destinations hosted at yahoo and gmail

nothing in maillog

I do see various _*odd things *_when checking var/mail/www
which is using X-Mailer: PHPMailer v2 - which I guess comes stock with wordpress and is also no longer working..

Return-Path: <www@bigkill>  (this seems not good)
Reporting-MTA: dns; bigkill  (this seems not good)

Now I'm trying to think what I changed but I honestly can't think of what it might be.. another push would be appreciated.


----------



## SirDice (Apr 28, 2010)

kutu62 said:
			
		

> I do see various _*odd things *_when checking var/mail/www
> which is using X-Mailer: PHPMailer v2 - which I guess comes stock with wordpress and is also no longer working..


Err.. You might want to contact your ISP. You may have been blacklisted for spamming :\

Check mailq. Also verify you're not getting NDR (bounces) in postmaster's mailbox (usually forwarded to root). Check with tcpdump and verify it's actually sending something out. If things are being sent but never received your mail maybe marked as junk (spamfilter).


----------



## kutu62 (Apr 28, 2010)

SirDice said:
			
		

> Err.. You might want to contact your ISP. You may have been blacklisted for spamming :\
> 
> Check mailq. Also verify you're not getting NDR (bounces) in postmaster's mailbox (usually forwarded to root). Check with tcpdump and verify it's actually sending something out. If things are being sent but never received your mail maybe marked as junk (spamfilter).



What leads you to say this?
I see nothing but legit emails trying to go out in var/mail. None of the emails are going to spam.

I don't think the emails are leaving my system.


----------



## SirDice (Apr 28, 2010)

kutu62 said:
			
		

> What leads you to say this?


Wordpress, strange entries in logs, not being able to send email.

It's not like I haven't seen it happen before 

In any case, use tcpdump and find out what's happening on the wire.

Problem solving and analysis require knowledge, not beliefs. I.e. don't guess or think it's not sending anything, know the actual fact.


----------



## kutu62 (Apr 28, 2010)

SirDice said:
			
		

> In any case, use tcpdump and find out what's happening on the wire.



tcpdump.. DUH!! Same as a packet capture on the network.. good idea! thanks

Okay I'm looking at the dumped pcap in wireshark and I see tons of email request from unknow sources trying to come in (pf is dropping those packets no syn ack back from sendmail) -- also no email going out (so im not a email relay for some loser) other than my two test email to different domains. I see these in the capture trying to go out...

I see some items in the email header that looks like garbage.. how can I make these items show up right.. or do you think it even matters. this could be my issue here


```
.(envelope-from www@myhostname)
Received: (from www@localhost)
```

how come both of these don't have the .com extension?

also if I was blacklisted I should be going into spam at yahoo.com and gmail - but I'm not. =(


----------



## DutchDaemon (Apr 28, 2010)

Set "sendmail_enable="NO" if you don't need to receive email from the outside. This will only allow Sendmail to act as a local MTA (running on localhost, which is enough for handling system email, even when sending it to the outside). If you want to send email to the outside world you'll have to configure a valid FQDN (one that works on the Internet) and configure Sendmail to use it correctly. If you don't have all that, just dump email in your root mailbox by setting the proper aliases in /etc/mail. Configuring an entirely valid Internet SMTP server with correct DNS settings is an entirely different ball game (which is not FreeBSD-specific, and there are plenty of FAQs and HowTos on the net).


----------



## kutu62 (Apr 29, 2010)

DutchDaemon said:
			
		

> Set "sendmail_enable="NO" if you don't need to receive email from the outside. Configuring an entirely valid Internet SMTP server with correct DNS settings is an entirely different ball game (which is not FreeBSD-specific, and there are plenty of FAQs and HowTos on the net).



Okay DD thanks - I've done as you said and think we have something to work with now.

Mail still isn't getting delivered (to inbox or spambox) but at least now I'm getting a maillog

Here are the symptoms:

LOG#1) cant send mail to domains hosted on server - (but server thinks the mail is delivered)
LOG#2) cant send mail to yahoo.com or other domain - (email is getting lookup failure)

_LOG#1 - MAIL SENT TO Domain whos website is hosted on server - mail is at google_

```
Apr 29 14:48:10 bigkill sm-mta[1186]: o3TIm4SP001184: to=<turner@absolutenetworks.biz>, ctladdr=<turner@bigkill.com> (1001/1001), 
delay=00:00:06, xdelay=00:00:06, mailer=esmtp, pri=30444, relay=aspmx.l.google.com. [209.85.221.12], dsn=2.0.0, stat=Sent (OK 1272566874 
11si1184359qyk.68)
```

_LOG#2 Mail sent to yahoo.com account - domain obviously not hosted on my server_

```
Apr 29 14:54:24 bigkill sm-mta[1213]: o3TIsNjS001211: to=<kutu62@yahoo.com>, ctladdr=<turner@bigkill.com> (1001/1001), delay=00:00:01, 
xdelay=00:00:01, mailer=esmtp, pri=30420, relay=a.mx.mail.yahoo.com. [67.195.168.31], dsn=4.0.0, stat=Deferred: Name server: 
a.mx.mail.yahoo.com.: host name lookup failure
```


Any ideas for LOG#1 - Not much I can find on google.

Numerous articles found for LOG#2 on the internet - I'll start there and will probably further mis-configure the server.. x(


----------

