2014-10-14 2 views
0

메일 기능을 사용하여 이메일을 보내려고합니다. 이메일은 내 로컬에서 처리되지만 호스트 된 서버에는 없습니다. 두 서버에서 매우 어울리는 한 가지는 메일()을 사용하여 헤더를 통과하려고하는 "보낸 사람"전자 메일 주소입니다.php mail()이 헤더를 통해 보낸 메일과 동일하지 않습니다.

두 서버가 동일한 "보낸 사람"전자 메일 주소를 보내고 있습니다. 그러나 내 이메일 결과는 매우 다릅니다. 내받은 편지함에있는 이메일에 이메일 주소 "에서"

그것으로 설정 내가 무엇을 내 호스팅 서버에 대한 내 로컬 서버 "www가 데이터"에 대한 "[email protected]을"이이 내 이메일의 "보낸 사람"헤더는 다음과 같습니다. [email protected]

$to = "[email protected]"; // this is your Email address 
$from = $_POST['email']; // this is the sender's Email address 

date_default_timezone_set('America/Los_Angeles'); 
$date = date("F j, Y, g:i a"); 

$title = checkValue('title', $_POST['title']); 
$first_name = checkValue('first name', $_POST['first-name']); 
$last_name = checkValue('last name', $_POST['last-name']); 
$email = checkValue('email address', $_POST['email']); 
$state = checkValue('state', $_POST['state-province']); 
$zip = checkValue('zip', $_POST['zip']); 
$city = checkValue('city', $_POST['city']); 
$country = checkValue('country', $_POST['country']); 
$addressOne = checkValue('address 1', $_POST['address-1']); 
$addressTwo = checkValue('address 2', $_POST['address-2']); 

// get phone and format 
$phoneArr = checkArrayValues($_POST['phone']); 
$phone = '['.$phoneArr['0'].'] ['.$phoneArr['1'].'] ['.$phoneArr['2'].']'; 

// get fax and format 
$faxArr = checkArrayValues($_POST['fax']); 
$fax = '['.$faxArr['0'].'] ['.$faxArr['1'].'] ['.$faxArr['2'].']'; 

$message = checkValue('message', $_POST['message']); 
$topic = checkValue('topic', $_POST['subject']); 

$emailBody = ' 
<html> 
    <head> 
     <title>HELLO</title> 
    </head> 
     <body> 
      <label>##Referrer##www.zout.com/contact-us##</label><br /> 
      <label>##Date## '.$date.'##</label><br /> 
      <label>##Topic## '.$topic.'##</label><br /> 
      <label>##First Name## ['.$first_name.']##</label><br /> 
      <label>##Last Name## ['.$last_name.']##</label><br /> 
      <label>##Street## ['.$addressOne.'], ['.$addressTwo.']##</label><br /> 
      <label>##Postal Code## ['.$zip.']##</label><br /> 
      <label>##City## ['.$city.']##</label><br /> 
      <label>##State## ['.$state.']##</label><br /> 
      <label>##Country of residence## ['.$country.']##</label><br /> 
      <label>##Phone## ['.$phone.']##</label><br /> 
      <label>##Fax## ['.$fax.']##</label><br /> 
      <label>##Email## ['.$email.']##</label><br /> 
      <label>##Message## ['.$message.']##</label><br /> 
     </body> 
    </html>'; 
    $headers = -"From: [email protected]" . "\r\n"; 
    $headers = 'MIME-Version: 1.0' . "\r\n"; 
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; 
    mail($to,$topic,$emailBody,$headers); 

원인은 무엇이며 어떻게 해결할 수 있습니까? 고마워요

+0

PHP 코드를 추가하십시오 –

답변

0

"답장"헤더도 설정해야합니다. "보낸 사람"이 보낸 사람과 일치하지 않으면 대부분의 전자 메일 클라이언트는이를 무시합니다.

또는 미리 작성된 라이브러리를 원하는 개수만큼 사용할 수 있습니다. 예를 들어, Here's 광산.

+0

포인터를 가져 주셔서 감사합니다. 나는 그것을 고칠 수 있었다. 프로세스에서 $ $ header 구문에 구문 오류가 있음을 알았습니다. – appthat

관련 문제