我正在尝试设置在用户提交表单时发送的基本电子邮件(他们输入详细信息,包括电子邮件地址,然后将感谢电子邮件发送到该电子邮件地址)。我在一个页面上工作,但是,当尝试在另一个页面上实现它时,我似乎无法获取他们输入的用户电子邮件地址。我已经习惯了非常基本的 PHP,而且我似乎无法让它工作的页面比我习惯的要复杂得多。
在我看来,我应该告诉要发送到 $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 = 'allen.hughes@hotmail.com';
$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";
}
?>