Problems with Mail Server

Hey ,

I have some problems to configure the E-Mail Server to restore my password etc.
I have configured msmtp and can send emails with them.

In nextcloud i have configured the mail server to send mails with localhost. But I don’t know whats wrong with my configuration. I get everytime this error message:

Beim Senden der E-Mail ist ein Problem aufgetreten. Bitte überprüfen Sie Ihre Einstellungen. (Fehler: Connection could not be established with host localhost [Verbindungsaufbau abgelehnt #111] Log data: ++ Starting Swift_SmtpTransport !! Connection could not be established with host localhost [Verbindungsaufbau abgelehnt #111] (code: 0))

My config.php looks like:

**'mail_smtpmode'** => **'smtp'** ,
**'mail_sendmailmode'** => **'pipe'** ,
**'mail_smtphost'** => **'localhost'** ,
**'mail_smtptimeout'** => 30,
**'mail_smtpdebug'** => true,
**'mail_from_address'** => **'...nextcloud'** ,
**'mail_domain'** => **'gmail.com'** ,
**'mail_smtpauthtype'** => **'LOGIN'** ,

Is msmtp listening on port 25 or is it only able to be accessed via a unix pipe connection. Is php.ini sendmail_path set to the correct sendmail compatible command for msmtp?

Do you have other PHP software on the system from which you can try to send e-mail?

I think you should first check if msmtp is correctly listening on localhost. You can check this by running telnet localhost 25 on your server. Next I would run msmtp in debug mode and check the log file for any messages which might unveil the root cause of the connection problem

telnet localhost 25
Trying ::1...
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused

But how i can i start msmtp in the background?

I have Postfix running on localhost and my config.php looks like:

  'mail_smtpmode' => 'smtp',
  'mail_smtphost' => 'localhost',
  'mail_sendmailmode' => 'smtp',

Working well for me.

You can find out if a mail server is running with the command

netstat -putan | grep :25

Once you’ve double-checked that the msmtp service is running, you should test access to your server again by trying it with the loop-back and also the official ip address of your server.

Thanks for your help. After i configured postfix it works.

1 Like