2016-09-17 3 views
1

에서 이메일을 보내도록 XAMPP를 구성하지만,이어떻게 PHP를 사용하여 로컬 호스트에서 이메일을 보내려고 로컬 호스트 PHP

<?php 
$to= "[email protected]"; 
$subject = "this is test"; 
$messages= "this is message test, congrats, your success" 

if(mail($to, $subject, $messages)) { 
echo "success guys"; 
} 
else{ 
echo "failed guys"; 
}; 

?> 

같은 코드가 어떻게 문제를 해결하기 위해 실패 하는가? 나는 리눅스를 사용하고있다. localhost에서 이메일을 보내도록 내 XAMPP를 구성하는 방법은 무엇입니까?

+2

[이 대답은 여기에 있습니다.] (http://stackoverflow.com/questions/15965376/how-to-configure-xampp-to-send-mail-from-localhost) –

답변

2

gmail이 메일을 보내려면 C : \ xampp \ php \ php.ini와 c : \ xampp \ sendmail \ sendmail.ini를 구성 할 수 있습니다.

(C : \ xampp \ php \ php.ini) 확장자 = php_openssl.dll을 찾고 해당 행의 시작 부분에서 세미콜론을 제거하여 localhost 용 gmail에서 SSL을 작동하게하십시오. php.ini의 파일에

는 [메일 기능]을 찾아 C:\xampp\sendmail\sendmail.ini

SMTP=smtp.gmail.com 
smtp_port=587 
sendmail_from = [email protected] 
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t" 

지금 열기로 변경합니다. sendmail.ini의 기존 코드를 모두 다음 코드로 바꿉니다.

[sendmail] 

smtp_server=smtp.gmail.com 
smtp_port=587 
error_logfile=error.log 
debug_logfile=debug.log 
[email protected] 
auth_password=your-gmail-password 
[email protected] 

이제 완료했습니다! 귀하의 Gmail 계정을 입력하십시오.

+0

리눅스를 사용하고 있는데 어디서 이메일을 보낼 수 있습니까? –

관련 문제