DokuWiki

It's better when it's simple

Инструменты пользователя

Инструменты сайта


ru:tips:mailconfig

Настройка почтовых уведомлений в Докувики

Если вы хотите, чтобы докувики могла использовать любой SMTP сервер, даже находящийся удаленно, обратите внимание на этотпатч, который добавляет Докувики эту возможность. Но этот патч не подходит для Виндоуз.

:?: If you are using Windows, wouldn't the «fake sendmail» program provide the same functionality? — Jeff 2007-02-27 20:49

:-? no way. after the patch in patch and hundred of attempts, mail are sent ONLY if I write all the mail addresses in $to instead of $bcc in mail.php. Using $bcc, mail are not sent. Sergio 2007-03-77 12:00

Специальные настройки для винды

Есть несколько способов настроить почту для винды:

Способ № 1: Using PHP to Send the Email Directly

Edit PHP.INI and set these variables (replace <mail.domain.tld> and <user@domain.tld> with the correct values):

; For Win32 only.
SMTP = <mail.domain.tld>
smtp_port = 25
sendmail_from = <user@domain.tld>

Restart the web server.

Способ № 2: Использование эмулятора Sendmail

Установите Sendmail для Windows ( http://www.glob.com.au/sendmail/sendmail.zip ). В PHP.INI закомментруйте строки, которые используют вышеуказанный способ №1, и вставьте следующие строки: (конечно же, путь к Sendmail у вас может отличаться):

; For Unix only.  You may supply arguments as well (default: \"sendmail -t -i\").
sendmail_path = C:\HostingServices\SendMail\sendmail.exe

Имейте в виду, что если путь к sendmail.exe содержит пробелы, то вы должны использоватеь короткие (8.3) названия файлов. Например, «C:\Progra~1\sendmail\sendmail.exe» вместо «C:\Program Files\sendmail\sendmail.exe».

Затем, отредактируйте sendmail.ini:

; you must change mail.mydomain.com to your smtp server
smtp_server=<mail.domain.tld>
; if your smtp server requires authentication, uncomment and modify the
; following two lines
;auth_username=
;auth_password=

Перестаруйте веб-сервер.

Пример конфигурирования Windows XP с PHP 5, используя второй способ

My company's Dokuwiki server is running XP Pro with PHP and Apache provided by XAMPP, and the November 2006 release of Dokuwiki. Our email server is named simply «Exchange».

I initially configured PHP.ini to use «exchange» as the smtp server (method #1 above), and this actually worked… only the link inside the «password reset» email came out malformed each time, so users couldn't reset their own passwords if they forgot them. To get around this, I ended up using the fake sendmail program and configuring it as follows.

So in PHP.ini (for XAMPP installations use C:\Program Files\xampp\apache\bin\php.ini), instead of specifying

; For Win32 only.
SMTP = exchange
smtp_port = 25

I commented those lines out and directed PHP to use the sendmail.exe program that ships with XAMPP (it's also available elsewhere; search for «fake sendmail»):

; For Unix only.
sendmail_path = "C:\Progra~1\xampp\sendmail\sendmail.exe -t"

Note that specifying «C:\Program Files» didn't work; I had to use the 8.3 notation of «Progra~1».

Then, in the fake sendmail's config file, sendmail.ini, I just had to specify

smtp_server=exchange

After restarting Apache, emails then sent correctly from within Dokuwiki.

Comments

Sendmail for Linux

PHP and safe mode

If you are using the PHP safe mode, you will need to remove the fifth parameter from the mail command at the end of the mail_send function in the ./inc/mail.php file. – http://www.wikini.net/wakka.php?wiki=ProgFou

Could you specify which part and from where? Thanks! (php-beginner)

Change

return @mail($to,$subject,$body,$header,$params);

to

return @mail($to,$subject,$body,$header);

Unix (Linux) sendmail setup

If you're running DokuWiki on a machine without a functioning sendmail, and you use another machine for sendmail services, here's a couple of simple ways to get it going. (1) is the preferable solution, but (2) might also work.

(1) Edit /etc/php.ini, and change these lines

; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
;sendmail_path =

to look like this

; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
sendmail_path = /usr/sbin/sendmail -syour.sendmail.host.com -t -i

Replace 'your.sendmail.host.com' with the name of the machine you use for sendmail services. Note that the ';' at the beginning of the line is removed. You may need to restart the web server for this to take effect (/etc/init.d/httpd restart).

(2) If for some reason you can't do (1), another solution is to create a script that pretends to be sendmail, and calls mini_sendmail instead. E.g.:

#!/bin/sh

/usr/sbin/mini_sendmail -syour.sendmail.host.com $@

Put these lines in a file called sendmail somewhere where PHP will find it and make the file executable (chmod +x /usr/sbin/sendmail for example). Of course you need to install mini_sendmail for this to work.

DokuWiki with an External Mail Server

When running a DokuWiki on Windows or other platforms you might find that you wish to use an SMTP server that does not reside on the same machine. Below find notes on how to accomplish this, especially with regards to a mail server that you do not administer. FIXME

:!: This patch to the 2006-11-06 version allows DokuWiki to talk to any SMTP server, including one which requires authentication.

Note: Windows installations can use the «fake sendmail» program to provide authentication instead of installing this patch. See Windows instructions for details.

(older comments)

Is there any news on making sendmail work on a server that one doesn't administer? — Alexander Kucera 2006/02/20 15:43

I would also like any news on running through a different SMTP server on the network. — Dennis Schulte 2006/04/25 16:24

I would also like any news on running through a different SMTP server on the network. — Paul Hoy 2006/09/16

I've not been successful in running Sendmail for Windows, yet. Has anyone managed to run Sendmail for Windows successfully? Thanks. – Straider (2004.09.02).
Try using sendmail_path = \«C:\HostingServices\SendMail\sendmail.exe -t -i\» as sendmail.exe requires -t to run and the Win32 version of PHP does not supply this by default as specified. – Jared (2005.23.01)
My dokuwiki server runs on windows - I am not admin but I think it uses sendmail. I got it running as follows:
  1. add \«ini_set('SMTP', $conf['smtphost']);\» to the top of mail.php
  2. set the mail server in local.php \«$conf['smtphost'] = 'your.smtp.host';\»
  3. in mail.php, delete the line \«$header = mail_encode_address($to, 'To');\» and change \«return @mail(null, …\» to \«return @mail($to, …\»
On Windows, with PHP properly installed to already know the SMTP and sendmail_from parameters, all I had to do was modify mail.php as described in the preceding note.
My ISP uses qmail with a windows server. Any ideas how to configure this one?
After modify php.ini, remember to restart Apache server, or you will still get an error. – Fwolf (2005.09.07)
Try to use the first method which simply modifies PHP.ini. I failed with the second one which requires sendmail.exe but succeeded with the first one. :-D – Minyang (2006.12.05)
This may have been due to the 8.3 path issue mentioned in the Windows example. — Jeff 2007-02-27 20:38
ru/tips/mailconfig.txt · Последнее изменение: 2016-04-07 07:24 — 194.190.143.1

Если не указано иное, содержимое этой вики предоставляется на условиях следующей лицензии: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki