Stefan1200's Forum

JTS3ServerMod Hosting Edition => JTS3ServerMod MySQL & WebInterface => FAQ / How To ... => Topic started by: Stefan1200 on March 19, 2016, 01:12:23 PM

Title: Web Interface can't send mails (Linux)
Post by: Stefan1200 on March 19, 2016, 01:12:23 PM
The JTS3ServerMod Web Interface is using the PHP mail function (http://php.net/manual/en/mail.configuration.php) to send mails, if someone registered to the Web Interface or used the resend password function. PHP itself requires an SMTP client to send a mail. In most cases a fully configured web server should have this.

If you don't have a mail server installed, you could install a full-featured mail transfer agent (MTA) like Postfix (http://www.postfix.org) to serve this function. But it's overkill if you only need to send mail through PHP, instead just install msmtp (http://msmtp.sourceforge.net/). It's lightweight and much simpler to configure.


Install msmtp
Install the packages msmtp and ca-certificates
Example on Debian:
apt-get install msmtp ca-certificates


Configure msmtp
Create a new configuration file at /etc/msmtprc with the following configuration information:
# Set default values for all following accounts.
defaults

# Enable or disable TLS/SSL encryption.
tls on
tls_starttls on
tls_trust_file /etc/ssl/certs/ca-certificates.crt

# Set up a default account's settings.
account default
host <smtp.example.net>
port 587
auth on
user <username@example.net>
password <password>
from <address-to-receive-bounces@example.net>
logfile /var/log/msmtp/msmtp.log


You need to put your own configuration information at host/username/password/from, make sure that you removed the brackets as well. For host/username/password, use your normal credentials for sending mail through your mail provider.

Tell PHP to use it, open your php.ini file, might be at /etc/php5/apache2/php.ini
To know the real path, check out the phpinfo() output at: Loaded Configuration File

Add/replace this single line:
sendmail_path = /usr/bin/msmtp -t


Set up logging
mkdir /var/log/msmtp
chown www-data:adm /var/log/msmtp
nano /etc/logrotate.d/msmtp


Add these lines to the new file:
/var/log/msmtp/*.log {
  rotate 12
  monthly
  compress
  missingok
  notifempty
}


If you'd like to be able to view the logs as yourself, you should add yourself to the www-data group.


Full msmtp documentation: http://msmtp.sourceforge.net/documentation.html
Title: Re: Web Interface can't send mails (Linux)
Post by: Shiroka on July 19, 2016, 09:08:08 PM
Hallo!

Alleine schon der zweite Schritt scheiter schon .

Configure msmtp
Create a new configuration file at /etc/msmtprc with the following configuration information:

Nur schade das er das Verzeichnis msmtprc ist nach der Eingabe : apt-get install msmtp ca-certificates

nicht vorhanden ist ...

MfG Shiroka
Title: Re: Web Interface can't send mails (Linux)
Post by: Stefan1200 on July 19, 2016, 09:38:30 PM
Quote from: Shiroka on July 19, 2016, 09:08:08 PM
Alleine schon der zweite Schritt scheiter schon .

Configure msmtp
Create a new configuration file at /etc/msmtprc with the following configuration information:

Nur schade das er das Verzeichnis msmtprc ist nach der Eingabe : apt-get install msmtp ca-certificates

nicht vorhanden ist ...

msmtprc ist kein Name von einem Verzeichnis, sondern der Name der Datei, die man erstellen soll.
Title: Re: Web Interface can't send mails (Linux)
Post by: Shiroka on July 20, 2016, 12:17:29 AM
Okay wird msmtp nur durch den einen Befehlst installiert oder muss da noch mehr gemacht werden  ?  ???
*EDIT*
Ich habe es mir schon denken können , läuft jz ast rein !
Title: Re: Web Interface can't send mails (Linux)
Post by: FeritGang on March 14, 2017, 11:06:07 PM
Hallo kannst du mir Helfen bitte bei mir geht es auch nicht wenn sich user in JTS3ServerMod Registriert sendet kein email an registrierter user und der user hat dann keine zugangsdaten für den webinterfaces
Title: Re: Web Interface can't send mails (Linux)
Post by: Jack on June 16, 2017, 08:59:18 PM
Create a new configuration file at /etc/msmtprc with the following configuration information:

What does the file name need to be called, and do you put the selected code into that file, As I cannot get my Mail to work.

I'm also unsure of what to put in the Host & From in the next bit...
Title: Re: Web Interface can't send mails (Linux)
Post by: Stefan1200 on June 16, 2017, 09:17:52 PM
Quote from: Jack on June 16, 2017, 08:59:18 PM
Create a new configuration file at /etc/msmtprc with the following configuration information:

What does the file name need to be called

You posted your answer for your first question already in your post...

Host = your mail server
From = The mail address for the from field of the mail header.

But I can't give support for other programs, which are not created by me. I not even use msmtp, I just created this how to, because I got many questions about how to enable php mail support on linux. Please ask the msmtp support for further help related to this topic.
Title: Re: Web Interface can't send mails (Linux)
Post by: Jack on June 18, 2017, 01:43:12 PM
Quote from: Stefan1200 on June 16, 2017, 09:17:52 PM
Quote from: Jack on June 16, 2017, 08:59:18 PM
Create a new configuration file at /etc/msmtprc with the following configuration information:

What does the file name need to be called

You posted your answer for your first question already in your post...

Host = your mail server
From = The mail address for the from field of the mail header.

But I can't give support for other programs, which are not created by me. I not even use msmtp, I just created this how to, because I got many questions about how to enable php mail support on linux. Please ask the msmtp support for further help related to this topic.
I have managed to get the Mail Server now sending to my email and to peoples emails when I make them accounts, I just needed to install 2 things on my VPS Server to get it running, Thank you for the help :D
Title: Re: Web Interface can't send mails (Linux)
Post by: Pekka893 on November 11, 2017, 01:10:16 AM
ich habe versucht alles so einzurichten wie in der Anleitung aber dann Funkt es nicht woran könnte es den Liegen?
Title: Re: Web Interface can't send mails (Linux)
Post by: Stefan1200 on November 11, 2017, 01:30:16 PM
Keine Ahnung. Es gibt einfach zu viele verschiedene Web Server Dienste und Betriebssysteme. Aber vielleicht kann jemand anderes helfen. Ansonsten bitte Google verwenden oder den Programmierer von msmtp anschreiben.
Title: Re: Web Interface can't send mails (Linux)
Post by: ls13game on November 13, 2017, 05:18:32 PM
Schau mal in den Spam ordner hat bei mir mit PHPMail geklappt
Title: Re: Web Interface can't send mails (Linux)
Post by: h4zebust3r90 on December 05, 2017, 04:58:21 AM
Hey,

Dachte mir das die Info vielleicht nützlich ist: Für den Versand per Gmail muss man vorher die IMAP Einstellungen aktivieren und unsicher Apps zulassen. Man bekommt von MSMTP den Hinweis mit einem Link.

Wenn dazu Fragen sind helfe ich gerne.
Title: Re: Web Interface can't send mails (Linux)
Post by: Jack on July 17, 2018, 05:37:26 PM
How would one go about doing this for windows?
Title: Re: Web Interface can't send mails (Linux)
Post by: Stefan1200 on July 17, 2018, 07:48:11 PM
Quote from: Jack on July 17, 2018, 05:37:26 PM
How would one go about doing this for windows?

check php.ini file:
[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = localhost
; http://php.net/smtp-port
smtp_port = 25

; For Win32 only.
; http://php.net/sendmail-from
sendmail_from = me@example.com
Title: Re: Web Interface can't send mails (Linux)
Post by: DanielK on January 04, 2020, 01:07:55 PM
Bei mir kommt immer noch ein "interener Fehler"
Title: Re: Web Interface can't send mails (Linux)
Post by: Stefan1200 on January 04, 2020, 01:16:30 PM
*** English ***
The correct configuration of PHP is also not my power. The PHP mail configuration has nothing to do with the JTS3ServerMod Web Interface and is a general topic. Please ask in a webmaster or PHP forum. I just googled the above howto manual and made it better readable.

*** Deutsch ***
Die korrekte Konfiguration von PHP ist auch nicht meine Stärke. Die PHP Mail Konfiguration hat nichts mit dem JTS3ServerMod Web Interface zu tun und ist ein ganz allgemeines Thema. Bitte in einem Webmaster oder PHP Forum nachfragen. Die obige Anleitung habe ich selbst nur ergoogelt und etwas lesbarer aufgeschrieben.