# SSMTP Bug



## Ricky (Oct 29, 2012)

Hi, I'm using SSMTP to send some mails. 

ssmtp.conf

```
#
# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.
root=*@gmail.com

# The place where the mail goes. The actual machine name is required
# no MX records are consulted. Commonly mailhosts are named mail.domain.com
# The example will fit if you are in domain.com and your mailhub is so named.
mailhub=smtp.gmail.com:587

# Where will the mail seem to come from?
rewriteDomain=

# The full hostname
hostname=gmail.com

AuthUser=*MyEmail
AuthPass=*MyPassword*
UseSTARTTLS=YES
```

And my ipfw rule to allow smtp gmail's server:

```
$IPF 800 allow tcp from smtp.gmail.com 587 to me
```

So far so good. At this point(considering I just rebooted my server) I'm perfectly able to send all emails that I want.

The problem is, after some days the IP of that address(smtp.gmail.com) changes(In fact everytime time you ping it will show up with a different IP than the previous).

I could simply reload ipfw.rules and it will update the IP but because of this line in my sysctl.conf

```
net.inet.tcp.blackhole=2
```

I'm getting this errors in my messages  log file:

```
Oct 29 12:01:23 kernel: TCP: [74.125.140.108]:587 to [192.168.1.85]:48490 tcpflags 0x12<SYN,ACK>; tcp_input: Connection attempt to closed port
Oct 29 12:01:23 kernel: TCP: [74.125.140.108]:587 to [192.168.1.85]:48490 tcpflags 0x12<SYN,ACK>; tcp_input: Connection attempt to closed port
Oct 29 12:01:24 kernel: TCP: [74.125.140.108]:587 to [192.168.1.85]:48490 tcpflags 0x12<SYN,ACK>; tcp_input: Connection attempt to closed port
Oct 29 12:01:25 kernel: TCP: [74.125.140.108]:587 to [192.168.1.85]:48490 tcpflags 0x12<SYN,ACK>; tcp_input: Connection attempt to closed port
Oct 29 12:01:27
```

Is there anything I can do to solve this instead of rebooting my system every time emails stops working? I believe what I have to do is allowing the kernel to accept the new IP. Just a theory as I am a newbie.

When I do
[CMD=""]sockstat -4[/CMD]

Should it show a entry like *.*.*.*:587  ? Could be this what is causing my problem?


----------



## Anonymous (Oct 29, 2012)

The man page of ssmtp(8)() tells us:


```
ssmtp is a [B][U]send-only[/U][/B] sendmail emulator for machines...
```

For me *send-only* translates to *outgoing mail only*. However, your ipfw is configured for smtp-587 in, i.e. *incoming mail*. Also the errors in your message log seem to relate to incoming connections.

If you want to send&receive e-mails, then mail/ssmtp is the wrong tool. Depending, on what exactly, you want to achieve, you need perhaps a full fledged MTA like mail/postfix or sendmail(8)() which can listen on smtp port 587 for incoming mails and forward them to local mailboxes and other end-points.

If you really wanted to send-only e-mails, then your ipfw rule is wrong.


----------



## Ricky (Oct 30, 2012)

Yes, you right, my ipfw rule is wrong. But if I reboot my server I will be able to send emails again. Also, my messages log doesn't make much sense. As you say it is related with incoming connections but in that case, my ipfw rules is right. Weird.
Anyway, thank you, I will try it this afternoon and report back the result.


----------

