2012-10-16 112 views
2

我想設置一個基本的電子郵件發送時,用戶提交表單(他們輸入的詳細信息,包括電子郵件地址,然後發送一封感謝電子郵件到該電子郵件地址)。我有這個工作在一個頁面上,但是,當試圖在另一個頁面上實現時,我似乎無法獲得他們輸入的用戶的電子郵件地址。我已經習慣了非常基本的PHP,而且我似乎無法使它工作的頁面比我以前的版本複雜得多。HTML謝謝電子郵件不發送

在我看來,我應該告訴電子郵件發送到$ uEmail,但是當我這樣做,沒有電子郵件發送。這個確切的代碼在另一個更基本的PHP頁面上工作,但是我需要的頁面是由比我更有經驗的人創建的。

我真的很感謝在這件事情上的幫助。

<form method="post" action="<?php echo $this->url('/clients/register', 'do_register')?>" class="clearfix"> 

     <?php if ($displayUserName) { ?> 
      <div> 
      <?php echo $form->label('uName', t('Username'))?> 
      <?php echo $form->text('uName')?> 
      </div> 
      <br/> 
     <?php } ?> 

     <div> 
      <div> 
      <?php echo $form->label('uEmail', t('Email Address'))?> 
      <span class="ccm-required">*</span> 
      </div> 
      <?php echo $form->text('uEmail')?> 
     </div> 
     <br/> 

     <?php 

     $attribs = UserAttributeKey::getRegistrationList(); 

     //UserAttributeKey::getRegistrationList(); 

     $af = Loader::helper('form/attribute'); 

     foreach($attribs as $ak) { 
//    $ak = UserAttributeKey::getByHandle($akHandle); 
      print $af->display($ak, $ak->isAttributeKeyRequiredOnRegister()); 
//    print '<br/><br/>'; 
     } 

     if (ENABLE_REGISTRATION_CAPTCHA) { 
      print $form->label('captcha', t('Please type the letters and numbers shown in the image.')); 
      //print '<br/>'; 
      $captcha = Loader::helper('validation/captcha'); 
      $captcha->display(); 
      ?> 

      <div><?php $captcha->showInput();?> </div> 
     <?php } ?> 

     <br/> 

     <!-- checkbox code --> 

     <!-- end checkbox code --> 

    <input type="hidden" name="sendCopy" id="sendCopy" value="true"<?php if(isset($_POST['sendCopy']) && $_POST['sendCopy'] == true) echo ' checked="checked"'; ?> /> 

     <div class="ccm-button"> 
      <?php echo $form->submit('register', t('Register'))?> 
      <?php echo $form->hidden('rcID', $rcID); ?> 
     </div> 

    </form> 
    <?php } ?> 

    <?php 
    if (mysql_affected_rows()) { 

    // NEW TEMP CODE 
    //if (isset($error) && $error != '') { 
    //if (isset($_POST['register'])) { 

    $emailTo = '[email protected]'; 
    $subject='Application form submission from test.com'; 
    $sendCopy = trim($_POST['sendCopy']); 
    $body = "Email: Hello! Thanks for applying...test***"; 
     $headers = 'From: Allen hughes ' . 'Reply-To: ' . $email; 

    mail($uEmail, $emailTo, $subject, $body); 

    if($sendCopy == true) { 
     $subject = 'You applied to Allenhughes.com'; 
    mail($uEmail, $subject, $body); 
    } 
    $emailSent = true; 
    } 
    else { 

    echo "Confirmation email has not been sent as email address has not been specified"; 

    } 

    ?> 

回答

1

此錯誤的90%是由您的服務器的某些配置錯誤引起的。

查看電子郵件日誌中的任何錯誤

還要檢查什麼郵件功能回到

if (mail()) { 
    echo 'succesful'; 
} 
+0

那是什麼配置error.How我可以修復 – Ansar

相關問題