2012-11-28 1 views
1
$res= mail('[email protected]', 'Email verification ','This is my own text'); 

print $res; 

이메일 ID로 메일을 보내려고했습니다. 나는 1 페이지를 가지고있다. 작동하는 것처럼 보이지만 실제로 작동하지 않습니다.부울 값이 true이고 정상적인 것처럼 보일 때 PHP 메일이 전송되지 않는 이유는 무엇입니까?

php.ini 파일 :

내가 어떻게 내 코드에 일어날 것을 추적 할 수 있음을 알고 싶어
define_syslog_variables = Off 

[mail function] 
; XAMPP: Comment out this if you want to work with an SMTP Server like Mercury 
SMTP = localhost 
smtp_port = 25 

; For Win32 only. 
; http://php.net/sendmail-from 
sendmail_from = [email protected] 

; XAMPP IMPORTANT NOTE (1): If XAMPP is installed in a base directory with spaces (e.g. c:\program files\xampp-portable) fakemail and mailtodisk do not work correctly. 
; XAMPP IMPORTANT NOTE (2): In this case please copy the sendmail or mailtodisk folder in your root folder (e.g. C:\sendmail) and use this for sendmail_path. 

; XAMPP: Comment out this if you want to work with fakemail for forwarding to your mailbox (sendmail.exe in the sendmail folder) 
sendmail_path = "\"\xampp-portable\sendmail\sendmail.exe\" -t" 

; XAMPP: Comment out this if you want to work with mailToDisk, It writes all mails in the \xampp-portable\mailoutput folder 
sendmail_path = "\xampp-portable\mailtodisk\mailtodisk.exe" 

; Force the addition of the specified parameters to be passed as extra parameters 
; to the sendmail binary. These parameters will always replace the value of 
; the 5th parameter to mail(), even in safe mode. 
;mail.force_extra_parameters = 

; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename 
mail.add_x_header = Off 

; Log all mail() calls including the full path of the script, line #, to address and headers 
;mail.log = "\xampp-portable\php\logs\php_mail.log" 

[SQL] 

. 내 로컬 PHP 서버에서 몇 가지 설정을 할 필요가 있다면 그들에 대해 말해.

xampp portable "관리자 권한으로 실행"을 사용하고 있습니다.

+2

문서에서 : "메일이 배달을 위해 받아 들여 졌기 때문에 메일이 의도 한 목적지에 실제로 도착한다는 것을 의미하지는 않습니다 ._"귀하의 PHP 코드는 더 이상 간단하지 않을 수 있습니다. 그러나 PHP를 넘어서는 메일 에이전트가 어떤 이유로 메시지를 전달하지 못합니다. 또는 목적지의 스팸 폴더에 걸렸을 수도 있습니다. 누가 알아. 그것은이 문제는 메일 전달 문제라면 [serverfault] (http://serverfault.com)에서 더 잘 처리 될 가능성이 있습니다. – Wiseguy

+0

SMTP와 sendmail 경로가 동시에 구성되는 이유는 무엇입니까? –

답변

1

말한다 파일에서 선이있다. mailToDisk를 사용하려면 행의 주석 처리를 제거해야하며 실제로 메일은/tmp/mailoutput에 기록됩니다.

0

댓글 시스템을 사용할 수 없으므로 여기에 게시 할 수 있습니다. 그러나 나는 이것이 당신이 찾고있는 대답이 아니라고 생각합니다.

XAMP가 이메일을 보내지 못할 수 있습니다. 대부분의 localhost 테스트 환경 (예 : xamp 또는 wamp)은 전자 메일을 보낼 수 없습니다. 먼저 메일 서버로 설정해야합니다. 메일 서버로 설정할 수는 있지만 무료 호스팅 (일부 "못생긴"하위 도메인 이름 사용)을 얻는 것이 더 쉽고 스크립트를 거기에두고 메일을 보내려고 시도하는 것이 더 쉽다고 생각합니다.

0

나는 다음과 같이 말하며 외출 중입니다. SMTP 서버가 설치되어 있지 않고 실행 중입니다. php.inimail()이라고 말하면 SMTP @ localhost : 25를 사용하기 때문에 실제로 설치 및 실행되지는 않습니다. mail() 함수는 실제로 문자를 보내지 않아도 true를 반환합니다.

SMTP 서버 (현재는 XAMPP와 함께 제공되지 않음)를 설치하고 실행 중이면 사과드립니다. 사용중인 SMTP 서버와 서비스 목록을 게시하여 실행 중인지 확인하십시오. 그러면 쉽게 진단 할 수 있습니다.

편집 그냥 SMTP 서버를 설정하지 않고 내 컴퓨터에서 테스트 :

$a= @mail('[email protected]', 'asdf', 'asdf'); 
if(!$a) 
    echo'False'; 
else 
    echo'True'; 

출력은 True입니다. 내 XAMPP 설치에

; XAMPP: Comment out this if you want to work with mailToDisk, It writes all mails in the \xampp-portable\mailoutput folder 
sendmail_path = "\xampp-portable\mailtodisk\mailtodisk.exe" 

, 나는 댓글이 잘못된 것을 발견했다 :

+0

나는 99.9 %의 SMTP 서버가 실행 중이고 PHP가 그것을 사용하도록 설정되어 있다면'mail()'은 실제로'false'를 리턴 할 것이라고 확신한다. –

+0

그냥 내 컴퓨터에서 테스트했습니다. SMTP가 없습니다. true를 반환합니다. –

+0

xamp에 대해서는 충분히 알지 못하지만, afmail은 센드 메일이 없기 때문에 창만 smtp에 연결됩니다. –