Projekt

Allgemein

Profil

Owncloud server setup outgoing mail » Historie » Version 1

Jeremias Keihsler, 13.01.2017 18:20

1 1 Jeremias Keihsler
h1. Owncloud server setup outgoing mail
2
3
see also http://doc.owncloud.org/server/5.0/admin_manual/configuration/configuration_mail.html
4
5
add following settings to @/var/www/html/owncloud/config/config.php@
6
<pre php>
7
<?php
8
$CONFIG = array (
9
  /* Enable SMTP class debugging */
10
  'mail_smtpdebug' => true,
11
12
  /* Mode to use for sending mail, can be sendmail, smtp, qmail or php, see PHPMailer docs */
13
  'mail_smtpmode' => 'smtp',
14
15
  /* Host to use for sending mail, depends on mail_smtpmode if this is used */
16
  'mail_smtphost' => 'mail.example.com',
17
18
  /* Port to use for sending mail, depends on mail_smtpmode if this is used */
19
  'mail_smtpport' => 587,
20
21
  /* SMTP server timeout in seconds for sending mail, depends on mail_smtpmode if this is used */
22
  'mail_smtptimeout' => 10,
23
24
  /* SMTP connection prefix or sending mail, depends on mail_smtpmode if this is used.
25
     Can be @, ssl or tls */
26
  'mail_smtpsecure' => 'tls',
27
28
  /* authentication needed to send mail, depends on mail_smtpmode if this is used
29
 * (false = disable authentication)
30
 */
31
  'mail_smtpauth' => true,
32
33
  /* authentication type needed to send mail, depends on mail_smtpmode if this is used
34
 * Can be LOGIN (default), PLAIN or NTLM */
35
  'mail_smtpauthtype' => 'LOGIN',
36
37
  /* Username to use for sendmail mail, depends on mail_smtpauth if this is used */
38
  'mail_smtpname' => 'mail@example.com',
39
40
  /* Password to use for sendmail mail, depends on mail_smtpauth if this is used */
41
  'mail_smtppassword' => 'secret',
42
43
44
);
45
46
</pre>
47
48
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
49
<pre><code class="bash">
50
setsebool -P httpd_can_network_connect 1
51
</code></pre>
52
53
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.
54
55
This is fixed as of ownCloud 7.0
56
57
<pre php mail.php>
58
// about line 73
59
                $mailo->From = $fromaddress;
60
                $mailo->FromName = $fromname;;
61
                //$mailo->Sender = $fromaddress;
62
                $mailo->Sender = 'mail@example.com';  //same as 'mail_smtpname' => 'mail@example.com' in config.php
63
                $a=explode(' ', $toaddress);
64
</pre>
65
maybe someone clever can patch it to use the configured value from @config.php@ instead of hard-coding it.