2013-10-28 1 views
0

$headers 및 두 번째 mail() 기능이 올바르지 않거나 부적절한가요? 내 페이지에는 수신자에게 전자 메일을 보내고 문자 메시지를 통해 두 번째 전자 메일을 보내는 양식이 있습니다 (많은 통신사는 전자 메일로 텍스트 기능을 제공합니다). 양식을 제출할 때 첫 번째 mail() 함수가 작동하지만 두 번째 것은 작동하지 않습니다. 아이디어가 있으십니까? 또한 이메일과 문자 메시지 (좋은 아이디어라고 생각 함)를 보내기를 원하기 때문에이 작업을 수행하고 있습니다. 그래서 수신자에게 관심이 필요한 이메일이 있음을 알립니다.다중 및 개별 메일 기능 PHP

내 뜻은 이렇습니다.

// HTML FORM here, collects just name, email, subject line, message 
// When the form is submitted it does this... 

      $to = "[email protected]"; 
      $to_sms = "[email protected]"; 
      $subject = filter_var($_POST['subject'], FILTER_SANITIZE_STRING)." - FORM"; 
      $headers = 'MIME-Version: 1.0' . "\r\n" . 
     'Content-type:text/html;charset=iso-8859-1' . "\r\n" . 
      'From: [email protected]' . "\r\n" . 
        'Reply-To: [email protected]' . "\r\n" . 
        'X-Mailer: PHP/' . phpversion(); 
      $body = " 
      <html> 
      <p>This is an automatic email notification. <strong>Please do not reply to this email</strong></p> 
      <p>You received a message from ". $name . " that needs your attention ASAP.!</p> 
      <p>Client name: ".$name."<br /> 
      Client phone: ".$phone."<br /> 
      Email: ".$email."<br /> 
      About: ".$_POST['subject']."<br /> 
      Message: ".$message."</p> 
      </html>"; 
      $body_sms = "Great news! ".$name." has contacted you via the FORM. Check your email now."; 

      // Send Email & Text Notification 
         //Here sends out the form via email 
      mail($to, $subject, $body, $headers); 
         //alternatively a second message is sent to another 
      mail($to_sms, $subject, $body_sms, "From: FORM"); 


//Echos a thank you. 
+1

'$ headers'의 사본을 만들고 이름을'$ headers2'로하고 문제 일 수있는'mail ($ to, $ subject, $ body_sms, $ headers2);'라고 사용 하시길 제안합니다. –

+0

@ Fred-ii- that works ... 답변을 신용 할 수 있도록 해주십시오. – mythoslife

+0

@ Fred-ii- thanks btw – mythoslife

답변

0

나는 $headers2

mail($to, $subject, $body_sms, $headers2); 

문제가 될 수 사용 당신이 당신의 $headers 이름의 복사본을 만들 좋습니다.