2012-12-14 8 views
2

내 사이트에 이메일 확인을 보내려고했습니다. 사람들은 문제없이 등록 할 수 있으며 모든 것이 데이터베이스에 등록되지만 전자 메일은 보내지 않습니다. 나는 그것을 정상적으로 시도했고 smtp 서버에 대한 약간의 오류를 주었다. 그래서 누군가 SurgeMailer를 시도해야한다고 말했다. 나는 그것을 다운로드하고, 지금 전자 우편은 실제로 그들이 보낸 것을 말한다, 그러나 전자 우편은 결코 그 (것)들을받지 않는다. 어떤 도움이라도 좋을 것입니다! 전자 메일을 보내는 코드를 작성합니다.PHP를 통해 메일 보내기

/*Send Email here*/ 
$to=$Email; 

$subject="Newgenstudios Account Confirmation"; 

/*From*/ 
$header="From:Newgenstudios <[email protected]>"; 

/* Your message */ /*Not Finished */ 
$message = "<h3>Welcome to the site ".ucfirst(strtolower($First_Name))."!</h3> 
<p>To complete your account registration, you must activate your account. Click on the link below or paste it into the URL to activate your account.</p> 
<p><a href='http://localhost/confirmation.php?passkey=$confirm_code'>Activate Now!</a </p> 
<p>Once your account has been activated, you may log in at anytime using the information you supplied below:<br /> 
<strong>Email: </strong>$Email<br /> 
<strong>Password: </strong>$Password</p> 
<p>Other Information:</p> 
<strong>Name: </strong>$First_Name<br /> 
<strong>Phone: </strong>$Phone<br /> 
<p>Thank you for registering and see you on the site!</p> 
<p>Did you not register? Then please disregard this message.</p>"; 

/* Send Email */ 
$sentmail = mail($to,$subject,$message,$header); 
} 

/*If not found*/ 
else { 
echo "Not found your email in our database"; 
} 

/* email succesfully sent */ 
if($sentmail){ 
echo "Your Confirmation link Has Been Sent To Your Email Address."; 
} 
else { 
echo "Cannot send Confirmation link to your e-mail address"; 
} 
?> 
+1

오류가 있는지 로그 파일을 확인하십시오. PHP'mail()'함수는 메일이 보내 졌음을 보장하지 않으며 배달을 위해서만 받아 들여졌다. – j08691

+0

btw HTML 전자 메일을 보내려면 MIME-TYPE 및 Content-type을 정의해야합니다. 페이지 하단의 예 : http://www.w3schools.com/php/func_mail_mail.asp – christopher

+0

MIME-TYPE 및 Content-Type은 포함 할 필요가 없습니다. 그것은 어쨌든 보낼 것입니다. @ user1868065 서버에서/var/log/maillog를 확인하고 거기에 오류가 있는지 확인하십시오. 서버에 액세스 할 수 없다면 SwiftMailer를 사용하고 IMAP과 같은 방법으로 다른 메일 서버를 통해 연결해보십시오. – ChrisG

답변

0

1- 시도이 메일 기능을 사용합니다. 단계는 그들에 의해 차단() 함수 당신은 내가 메일을 추측 호스팅 문의하시기 바랍니다 작동하지 않을 경우 [email protected]

3 : 같은 도메인에 관련된 유효한 이메일 "값에서"

2 쓰기.

function send_mail($to,$from,$subject,$msg){ 
     // message 
     $message = ' 
     <html> 
     <head> 
      <title>Message</title> 
     </head> 
     <body dir="rtl"> 
     <p align="right">' 
     . $msg . 
     '</p> 
     <br> 

     </p> 
     </body> 
     </html> 
     '; 

     // To send HTML mail, the Content-type header must be set 
     $headers = 'MIME-Version: 1.0' . "\n"; 
     $headers .= 'Content-type: text/html; charset=utf-8' . "\n"; 

     // Additional heade rs 
     $headers .= "From: ".$from . "\n"; 
     //$headers .= 'Bcc: [email protected]' . "\n"; 

     // Mail it 
     return mail($to, '=?windows-1256?B?'.base64_encode($subject).'?=', $message, $headers); 
    } 
+0

사실 Php 메일러를 사용해 보았는데 PHP 메일 확장 중 하나가 꺼져 있었고 Phpmailer를 사용하여 시도했습니다. 스타일, 그리고 그것을 밖으로 작동하지만, 당신의 도움을 주셔서 감사합니다! – user1868065

0

Gmail 계정을 사용하여 이메일을 보내는 것이 좋습니다. 설정하는 것이 가장 빠릅니다. (그냥 구글 'PHP Gmail 이메일 보내기'). 또한 스팸 폴더를 확인하는 것을 잊지 마십시오.

관련 문제