Projekt

Allgemein

Profil

Aktionen

Owncloud server setup outgoing mail

see also http://doc.owncloud.org/server/5.0/admin_manual/configuration/configuration_mail.html

add following settings to /var/www/html/owncloud/config/config.php

<?php
$CONFIG = array (
  /* Enable SMTP class debugging */
  'mail_smtpdebug' => true,

  /* Mode to use for sending mail, can be sendmail, smtp, qmail or php, see PHPMailer docs */
  'mail_smtpmode' => 'smtp',

  /* Host to use for sending mail, depends on mail_smtpmode if this is used */
  'mail_smtphost' => 'mail.example.com',

  /* Port to use for sending mail, depends on mail_smtpmode if this is used */
  'mail_smtpport' => 587,

  /* SMTP server timeout in seconds for sending mail, depends on mail_smtpmode if this is used */
  'mail_smtptimeout' => 10,

  /* SMTP connection prefix or sending mail, depends on mail_smtpmode if this is used.
     Can be @, ssl or tls */
  'mail_smtpsecure' => 'tls',

  /* authentication needed to send mail, depends on mail_smtpmode if this is used
 * (false = disable authentication)
 */
  'mail_smtpauth' => true,

  /* authentication type needed to send mail, depends on mail_smtpmode if this is used
 * Can be LOGIN (default), PLAIN or NTLM */
  'mail_smtpauthtype' => 'LOGIN',

  /* Username to use for sendmail mail, depends on mail_smtpauth if this is used */
  'mail_smtpname' => 'mail@example.com',

  /* Password to use for sendmail mail, depends on mail_smtpauth if this is used */
  'mail_smtppassword' => 'secret',

);

if you experience trouble with {"app":"mail","message":"SMTP Error: Could not connect to SMTP host.","level":3,"time":1363709674} it might be that SELinux doesn't allow PHP to make outgoing connections. You may fix this by

setsebool -P httpd_can_network_connect 1

since it turned out that owncloud uses the FROM also for the SENDER address and not the configured mail_smtpname a hack in ./owncloud/lib/private/mail.php was necessary.

This is fixed as of ownCloud 7.0

// about line 73
                $mailo->From = $fromaddress;
                $mailo->FromName = $fromname;;
                //$mailo->Sender = $fromaddress;
                $mailo->Sender = 'mail@example.com';  //same as 'mail_smtpname' => 'mail@example.com' in config.php
                $a=explode(' ', $toaddress);

maybe someone clever can patch it to use the configured value from config.php instead of hard-coding it.

Von Jeremias Keihsler vor mehr als 7 Jahren aktualisiert · 1 Revisionen