1

I'm trying to send emails from an ubuntu-server (14.04.2 LTS) via the command-line and later inside small scripts. To do so, I want to use ssmtp with an external mailserver, inside the network, that doesn't need any authentication. Meaning there is a smtp-server (external-server.com:25) on another host, which I want to use to send mails. Since my host and the smtp-server are in the same network I can access the smtp-server without any authentication.

Therefore I configured ssmtp to use that external server, here is my ssmtp.conf:

#
# Config file for sSMTP sendmail
#
# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.
[email protected]

# The place where the mail goes. The actual machine name is required no 
# MX records are consulted. Commonly mailhosts are named mail.domain.com
mailhub=external-server.com:25

# Where will the mail seem to come from?
rewriteDomain=external-server.com

# The full hostname
#hostname=

# Are users allowed to set their own From: address?
# YES - Allow the user to specify their own From: address
# NO - Use the system generated From: address
#FromLineOverride=YES

#Settings for sending logfiles as [email protected]
[email protected]
AuthPass=
UseTLS=YES
UseSTARTTLS=YES

I can now call ssmtp [email protected] and type in a message like this:

To: [email protected]
From: [email protected]
Subject: Test

Lorem ipsum ...

If I now hit Ctrl+D simply nothing happens, I can literally wait for minutes. Also Ctrl+C seems to be ignored. Just Ctrl+Z works.

The mail.err-log is empty and mail.log just states

Mar 23 14:53:50 ubuntu-server sSMTP[2810]: Creating SSL connection to host

I also verified, that a connection is started using tcpdump. Therefore the only problem I can point out is, that Ctrl+D seems to be ignored. Does anyone know this problem or even better a solution?

EDIT

Actually the problem was, that the AuthUser field wasn't empty and that other subnets were allowed to use the smtp-server, but not my subnet.

It was also very to uncomment FromLineOverride=YES, thus users could use their own mailaddresses.

7
  • You may find this useful: tombuntu.com/index.php/2008/10/21/…
    – Elder Geek
    Mar 23, 2015 at 15:28
  • Could a lack of patience be the problem?
    – Elder Geek
    Mar 23, 2015 at 15:29
  • @ElderGeek I did the configuration according to the tutorial you posted. And I actually waited for about a minute after pressing Ctrl + D I was also still able to type characters after pressing Ctrl + D
    – Dave
    Mar 23, 2015 at 15:36
  • If the mailserver is "inside your network", wouldn't that be considered an internal server?
    – Elder Geek
    Mar 23, 2015 at 16:12
  • Can you edit your question and clarify "external mailserver, inside the network," It's a bit confusing and you may receive far better answers than mine if you do so.
    – Elder Geek
    Mar 23, 2015 at 16:44

1 Answer 1

3

I'm by no means an expert on this topic, however your configuration appears to be missing:

TLSCert
The file name of an RSA certificate to use for TLS, if required.
TLSKey
The file name of an RSA key to use for TLS, if required.
TLS_CA_File
A file of trusted certificates for validating the server, if required.
TLS_CA_Dir
A directory of trusted certificates for validating the server, if required.

I would assume these are required if using TLS

Source: http://linux.die.net/man/5/ssmtp.conf

5
  • I will give it a try. Do you know a good source for the TLS_CA files? I will first try with just the last option, because the first two look like they are just needed if I want to receive mails as well.
    – Dave
    Mar 23, 2015 at 15:52
  • Not off the top of my head. I'll google it.
    – Elder Geek
    Mar 23, 2015 at 15:54
  • I did a little search myself. I think it depends on the root authority. For example for GeoTrust they can be found here: geotrust.com/resources/root-certificates I think I know which certificate is the one I need.
    – Dave
    Mar 23, 2015 at 15:56
  • More info on TLS can be found here: chimera.labs.oreilly.com/books/1230000000545/ch04.html and here: security.stackexchange.com/questions/20803/…
    – Elder Geek
    Mar 23, 2015 at 15:59
  • I tried setting the TLS_CA_File, after some errors I found out, that the online manpage at linux.die.net is outdated. Noew there is just TLSCert left as argument. But after I was able to actually set the parameter the behaviour stayed the same. But I noticed that the terminal seems to recognize the Ctrl + D, because the cursor stops blinking for a moment.
    – Dave
    Mar 23, 2015 at 23:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .