2014-09-01 2 views
0

enter image description herephpmailer 오류 이메일로

코드를 전송 한 후 : -

$mail = new PHPMailer(); 
$body="<b>This mail is sent using PHP Mailer</b>";#HTML tags can be included 
$mail->IsSMTP(); 
$mail->SMTPAuth = true;     #enable SMTP authentication 
$mail->SMTPSecure = "tls";    #sets the prefix to the server 
$mail->Host = "smtp.gmail.com";   #sets GMAIL as the SMTP server 
$mail->Port  = 587;     #set the SMTP port 
$mail->Username = "[email protected]";  #your gmail username 
$mail->Password = "***********";     #Your gmail password 
$mail->From = $email;  
$mail->FromName = $name ;     
$mail->Subject = "Enquiry"; 
$mail->Body = $messages; 
$mail->AddAddress("[email protected]","contact"); 
$mail->IsHTML(true); // send as HTML 

if(!$mail->Send()) { 
echo 'Message was not sent.'; 
echo 'Mailer error: ' . $mail->ErrorInfo; 
} else { 
echo 'Mail has Been Sent.'; 
} 
} 

나는 [email protected][email protected]로 대체되는 것을 원한다. 이것이 가능한가 ?

+0

를 사용합니다. 어떤 인스턴스를 다른 것으로하고 싶은지는 말하지 않습니다.하지만 필요한 작업은 모두 변경해야합니다. – Synchro

답변

0
$mail->AddAddress("[email protected]","contact"); 

또는 주소 코드, 그것은 (당신이 전체 코드를 제공하지했습니다)`$의 email`에 있다면 아마도 세 번째에 두 번 나타납니다

$mail->AddCC("[email protected]","contact"); 
+0

abhishek이 (가) 사용자이며 [email protected]에 해당 사용자의 이메일이 표시되기를 바랍니다. $ mail-> From = $ email; 이 코드는 작동하지 않습니다. –

+0

그래서 자신의 헤더를 설정해야합니다. 헤더에 From :을 추가하십시오. $ headers = "". "답장 :". $에서. "\ r \ n". "보낸 사람 :". $에서. "\ r \ n". "X-Mailer : PHP /". phpversion(); $ headers. = 'MIME-Version : 1.0'. "\ r \ n"; $ headers. = '콘텐츠 유형 : text/html; charset = iso-8859-1 '. "\ r \ n"; – Makram

+0

아니요, ** 자신의 헤더를 설정하지 마십시오.이 코드는 PHPMailer를 사용하고 있습니다. 보낸 사람 주소를 변경하려면'$ mail-> From = '[email protected]'; ' – Synchro