<div><html></div> <div><head> </div> <div><title>PHPMailer - SMTP (Gmail) basic test</title> </div> <div></head> </div> <div><body> </div> <div><?php</div> <div>require 'Mailer/class.phpmailer.php';</div> <div>$mail = new PHPMailer;</div> <div>$mail->IsSMTP(); // Set mailer to use SMTP</div> <div>$mail->host = 'stmp.gmail.com'; // smtp 주소 </div> <div>$mail->Port=587;</div> <div>$mail->SMTPAuth = true; // Enable SMTP authentication</div> <div>$mail->Username = '
[email protected]'; // SMTP username 메일주소</div> <div>$mail->Password = 'password'; // SMTP password 메일 접속 시 비밀번호</div> <div>$mail->SMTPSecure = 'ssl'; // Enable encryption, 'ssl' also accepted </div> <div> </div> <div>$mail->From = '
[email protected]'; //보내는 사람 메일 주소</div> <div>$mail->FromName = 'Mailer'; //보내는 사람 이름</div> <div>$mail->AddAddress('
[email protected]'); // Add a recipient 받는 사람 주소, 받는 사람 이름</div> <div> // Name is optional 받는 사람 이메일 주소만</div> <div><br /></div> <div>$mail->IsHTML(true); // Set email format to HTML 메일을 보낼 때 html 형식으로 메일을 보낼 경우 true</div> <div> </div> <div>$mail->Subject = 'Here is the subject'; //메일 주소</div> <div>$mail->Body = 'This is the HTML message body <B>in bold!</B>'; //메일 본문</div> <div>$mail->AltBody = 'This is the body in plain text for non-HTML mail clients'; // 메일 본문을 오로지 텍스트 형식으로만 보낼 때 </div> <div> </div> <div>if(!$mail->Send()) </div> <div>{</div> <div> echo '보낼수 없음.';</div> <div> echo 'Mailer Error: ' . $mail->ErrorInfo; // 메일 전송에 실패 했을 경우 뜨는 에러 메세지</div> <div> exit;</div> <div>}</div> <div> </div> <div>echo 'Message has been sent';</div> <div>?></div> <div></html></div> <div><br /></div> <div>소스는 이렇게 되는데</div> <div><br /></div> <div>에러가 </div> <div><span style="font-family: Gulim; font-size: medium; line-height: normal">Mailer Error: The following From address failed: @gmail.com : Called Mail() without being connected</span></div> <div><span style="font-family: Gulim; font-size: medium; line-height: normal"><br /></span></div> <div><font face="Gulim" size="2"><span style="line-height: normal">라고 뜨네요.. 어디가 문제일까요......하루종일 이것만하네요...</span></font></div>