# Postfix cannot send email



## fred974 (Aug 4, 2014)

Hello everyone,

I wonder if someone could help me in identifying a problem. I have set up Postfix and it looks to be working ok. When I send a test email *as root* with `mail [email=webmaster@mydomain.com]webmaster@mydomain.com[/email]`, I get the following in the log file:

```
Aug  4 09:42:29 BSDhost sendmail[2435]: s749gSTH002435: from=BSDadmin, size=52, class=0, nrcpts=1, msgid=<201408040942.s749gSTH002435@BSDhost.skint.ltd>, relay=root@localhost
Aug  4 09:42:29 BSDhost postfix/smtpd[2436]: connect from localhost[127.0.0.1]
Aug  4 09:42:29 BSDhost postfix/smtpd[2436]: 19ACE180B2: client=localhost[127.0.0.1]
Aug  4 09:42:29 BSDhost postfix/cleanup[2439]: 19ACE180B2: message-id=<201408040942.s749gSTH002435@BSDhost.skint.ltd>
Aug  4 09:42:29 BSDhost sendmail[2435]: s749gSTH002435: to=webmaster@mydomain.com, ctladdr=BSDadmin (1001/1001), delay=00:00:01, xdelay=00:00:00, mailer=relay, pri=30052, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (Ok: queued as 19ACE180B2)
Aug  4 09:42:29 BSDhost postfix/qmgr[2288]: 19ACE180B2: from=<BSDadmin@BSDhost.skint.ltd>, size=602, nrcpt=1 (queue active)
Aug  4 09:42:29 BSDhost postfix/smtpd[2436]: disconnect from localhost[127.0.0.1]
Aug  4 09:42:29 BSDhost postfix/smtp[2440]: connect to 127.0.0.1[127.0.0.1]:11125: Connection refused
Aug  4 09:42:29 BSDhost postfix/smtp[2440]: 19ACE180B2: to=<webmaster@mydomain.com>, relay=none, delay=0.14, delays=0.13/0.01/0/0, dsn=4.4.1, status=deferred (connect to 127.0.0.1[127.0.0.1]:11125: Connection refused)
```

I know that the reason my email is not being sent is because the from user is 'BSDadmin'. /etc/mail/aliases has the following:

```
root: serverstatus@skintltd.com
```

Could someone tell me why the root user from /etc/mail/aliases is not being picked up?

Another note: BSDadmin is actually a normal user in the wheel group*.*


----------



## SirDice (Aug 4, 2014)

You are forwarding your email to 127.0.0.1:11125 and there appears to be nothing listening on that port.


----------



## fred974 (Aug 4, 2014)

SirDice said:
			
		

> You are forwarding your email to 127.0.0.1:11125 and there appears to be nothing listening on that port.



Yes sorry, I realized that stunnel wasn't turned on. I have since turned it on but it is still sending email as BSDadmin.


----------



## neel (Aug 5, 2014)

Is it possible to post your Postfix main.cf or master.cf?


----------



## fred974 (Aug 5, 2014)

neel said:
			
		

> Is it possible to post your Postfix main.cf or master.cf?


Of couse 

/usr/local/etc/postfix/main.cf

```
mydestination = zoho.com, localhost.skint.ltd, localhost
relayhost = [127.0.0.1]:11125
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/usr/local/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
#smtp_tls_CAfile = /usr/local/etc/postfix/cacert.pem
smtp_use_tls = yes
```

/usr/local/etc/postfix/sasl_passwd

```
[127.0.0.1]:11125     serverstatus@skintltd.com:mysecretpassword
```
/usr/local/etc/stunnel/stunnel.conf

```
setuid = stunnel
setgid = nogroup
;output = /var/log/stunnel.log

[smtp-tls-wrapper]
accept=11125
client=yes
connect = smtp.zoho.com:465
```
I think that the issue is with the first line of my main.cf but I just don't know how to set it up right.


----------



## fred974 (Aug 8, 2014)

*A*nyone please?


----------



## fred974 (Sep 12, 2014)

Hi guys,

I have been working on this for a while now an I still have the problem.
Could anyone help please?
If you know of any how to to I can read trough I'll take that.

Thank you
Fred


----------



## chrbr (Sep 14, 2014)

I am not 100% sure what you like to achieve and I have some additional questions. Regarding /etc/aliases it is necessary to generate a file /etc/aliases.db out of that. Are you using postfix to connect your ISP or do you operate the server to be connected from outside? If your server should be connected from the internet I have no expertise at all and can not help. If postfix should just forward your mail to your ISP you can use the version with STARTTLS and so on enabled. In this case you should not need stunnel. 

I have a question regarding stunnel which I have not tired up to now. Your main.cf shows some configuration about TLS. Are you sure that this is necessary? Or are you sure that this does not interfere? Up to now I have thought that stunnel should take care about that.


----------



## fred974 (Sep 15, 2014)

Hi @chrbr

I will look at the problem a bit more with the points you mentioned.
I don't know the answer to them all yet.

Thank you


----------

