|
 29.6 Кб |
|
| Отправляю почту через программу sendmail.exe локально со своей машины
делаю ледующие настройки в файле php.ini:
[mail function]
; For Win32 only.
SMTP =
smtp_port = 25
; For Win32 only.
sendmail_from =
sendmail_path = "C:\wamp\sendmail\sendmail.exe -t"
|
sendmail.ini
; configuration for fake sendmail
; if this file doesn't exist, sendmail.exe will look for the settings in
; the registry, under HKLM\Software\Sendmail
[sendmail]
; you must change mail.mydomain.com to your smtp server,
; or to IIS's "pickup" directory. (generally C:\Inetpub\mailroot\Pickup)
; emails delivered via IIS's pickup directory cause sendmail to
; run quicker, but you won't get error messages back to the calling
; application.
smtp_server=smtp.mail.ru
; smtp port (normally 25)
smtp_port=25
; SMTPS (SSL) support
; auto = use SSL for port 465, otherwise try to use TLS
; ssl = alway use SSL
; tls = always use TLS
; none = never try to use SSL
smtp_ssl=auto
; the default domain for this server will be read from the registry
; this will be appended to email addresses when one isn't provided
; if you want to override the value in the registry, uncomment and modify
default_domain=mail.ru
; log smtp errors to error.log (defaults to same directory as sendmail.exe)
; uncomment to enable logging
error_logfile=error.log
; create debug log as debug.log (defaults to same directory as sendmail.exe)
; uncomment to enable debugging
debug_logfile=debug.log
; if your smtp server requires authentication, modify the following two lines
auth_username=мой_адрес@mail.ru
auth_password=мой_пароль
; if your smtp server uses pop3 before smtp authentication, modify the
; following three lines. do not enable unless it is required.
pop3_server=pop.mail.ru
pop3_username=мой_адрес@mail.ru
pop3_password=мой_пароль
; force the sender to always be the following email address
; this will only affect the "MAIL FROM" command, it won't modify
; the "From: " header of the message content
force_sender=мой_адрес@mail.ru
; force the sender to always be the following email address
; this will only affect the "RCTP TO" command, it won't modify
; the "To: " header of the message content
force_recipient=
; sendmail will use your hostname and your default_domain in the ehlo/helo
; smtp greeting. you can manually set the ehlo/helo name if required
hostname=mail.ru
|
скрипт отправки:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Simple Mail</title>
</head>
<body>
<?php
$addr = $_POST['addr'];
$theme = $_POST['theme'];
$text = $_POST['text'];
if (isset($addr) && isset($theme) && isset($text)
&& $addr != "" && $theme != "" && $text != "") {
if (mail($addr, $theme, $text, "From: мой_адрес@mail.ru")) {
echo "<h3>The letter was sent</h3>";
}
else {
echo "<h3>sending Error!</h3>";
}
}
?>
<form action="sendmail.php" method="post">
<p>
<label for="addr">e-mail:</label>
<input type="text" name="addr" id="addr" size="30" />
</p>
<p>
<label for="theme">Theme:</label>
<input type="text" name="theme" id="theme" size="30" />
</p>
<p>
<label for="text">Text:</label>
<textarea rows="10" cols="20" name="text" id="text"></textarea>
</p>
<p>
<input type="submit" value="Send" />
</p>
</form>
</body>
</html>
|
после отправки в debug.log пишет
11.01.08 01:13:49 ** --- MESSAGE BEGIN ---
11.01.08 01:13:49 ** To: адрес@yandex.ru
11.01.08 01:13:49 ** Subject: dsfsddfs
11.01.08 01:13:49 ** From: мой_адрес@mail.ru
11.01.08 01:13:49 **
11.01.08 01:13:49 ** sdfsff
11.01.08 01:13:49 ** --- MESSAGE END ---
11.01.08 01:13:49 ** Authenticating with POP3 server
11.01.08 01:13:52 ** Connected.
11.01.08 01:13:53 << +OK<EOL>
11.01.08 01:13:53 >> CAPA<EOL>
11.01.08 01:13:53 << +OK Capability list follows<EOL>TOP<EOL>USER<EOL>LOGIN-DELAY 120<EOL>EXPIRE NEVER<EOL>UIDL<EOL>IMPLEMENTATION Mail.Ru<EOL>SASL LOGIN PLAIN<EOL>STLS<EOL>.<EOL>
11.01.08 01:13:53 >> USER мой_адрес@mail.ru<EOL>
11.01.08 01:13:53 << +OK<EOL>
11.01.08 01:13:53 >> PASS мой_пароль<EOL>
11.01.08 01:13:54 << +OK Welcome!<EOL>
11.01.08 01:13:54 >> QUIT<EOL>
11.01.08 01:13:54 << +OK POP3 server at mail.ru signing off<EOL>
11.01.08 01:13:54 ** Disconnected.
11.01.08 01:13:54 ** Disconnected.
11.01.08 01:13:54 ** Disconnected.
11.01.08 01:13:54 ** Connecting to smtp.mail.ru:25
11.01.08 01:13:54 ** Connected.
11.01.08 01:13:55 << 220 smtp1.mail.ru ESMTP ready<EOL>
11.01.08 01:13:55 >> EHLO mail.ru<EOL>
11.01.08 01:13:55 << 250-smtp1.mail.ru<EOL>250-SIZE 31457280<EOL>250-8BITMIME<EOL>250-AUTH PLAIN LOGIN<EOL>250 STARTTLS<EOL>
11.01.08 01:13:55 ** Authenticating as мой_адрес
11.01.08 01:13:55 >> STARTTLS<EOL>
11.01.08 01:13:56 << 500 5.5.1 Invalid command<EOL>
11.01.08 01:13:56 >> QUIT<EOL>
11.01.08 01:13:57 << 221 2.0.0 Bye<EOL>
11.01.08 01:13:57 ** Disconnected.
11.01.08 01:13:57 ** Disconnected.
11.01.08 01:13:57 ** Disconnected.
11.01.08 01:13:57 ** Start SSL negotiation command failed.
|
и в процессе отправки вылетает окно с ошибкой (см. файл приложен):
подозреваю, что ошибка связана с этим
11.01.08 01:13:56 << 500 5.5.1 Invalid command<EOL>
|
кто работал с sendmail прошу помочь разобраться.... | |
|
|
|
|
|
|
|
для: lightning.say
(07.01.2011 в 18:21)
| | Все, разобрался. Надо было в php.ini и sendmail.ini указать другой номер порта
smtp_port = 2525 | |
|
|
|
|
|
|
|
для: lightning.say
(08.01.2011 в 03:55)
| | . | |
|
|
|