Im trying to make 2 forms. 1 simple contact form, 2 only for email.
I want to use magentos email system (contact email) so im using if else in the email template.
My second form template wont sendt. I get the "could not send email"
most likely some litle typo or something. can you help?
Here are the code
Contact form template (standard magento)
<div id="messages_product_view"><?php echo $this->getMessagesBlock()->getGroupedHtml() ?></div>
<div class="page-title" style="margin-left: 2%;">
<h1><?php echo Mage::helper('contacts')->__('Kontakt IFP') ?></h1>
</div>
<form action="<?php echo $this->getFormAction(); ?>" id="contactForm" method="post">
<div class="fieldset">
<h2 class="legend"><?php echo Mage::helper('contacts')->__('Kontaktformular') ?></h2>
<ul class="form-list">
<li class="fields">
<div class="field" style="padding-right: 1%;">
<label for="name" class="required"><em>*</em><?php echo Mage::helper('contacts')->__('Name') ?></label>
<div class="input-box">
<input name="name" id="name" title="<?php echo Mage::helper('contacts')->__('Name') ?>" value="<?php echo $this->htmlEscape($this->helper('contacts')->getUserName()) ?>" class="input-text required-entry" type="text" />
</div>
</div>
<div class="field">
<label for="email" class="required"><em>*</em><?php echo Mage::helper('contacts')->__('Email') ?></label>
<div class="input-box">
<input name="email" id="email" title="<?php echo Mage::helper('contacts')->__('Email') ?>" value="<?php echo $this->htmlEscape($this->helper('contacts')->getUserEmail()) ?>" class="input-text required-entry validate-email" type="text" />
</div>
</div>
</li>
<li>
<label for="telephone"><?php echo Mage::helper('contacts')->__('Telephone') ?></label>
<div class="input-box">
<input name="telephone" id="telephone" title="<?php echo Mage::helper('contacts')->__('Telephone') ?>" value="" class="input-text" type="text" />
</div>
</li>
<li class="wide">
<label for="comment" class="required"><em>*</em><?php echo Mage::helper('contacts')->__('Comment') ?></label>
<div class="input-box">
<textarea style="width: 100%;" name="comment" id="comment" title="<?php echo Mage::helper('contacts')->__('Comment') ?>" class="required-entry input-text" cols="5" rows="3"></textarea>
</div>
</li>
</ul>
</div>
<div class="buttons-set">
<p class="required"><?php echo Mage::helper('contacts')->__('* Required Fields') ?></p>
<input type="text" name="hideit" id="hideit" value="" style="display:none !important;" />
<button type="submit" title="<?php echo Mage::helper('contacts')->__('Submit') ?>" class="button"><span><span><?php echo Mage::helper('contacts')->__('Submit') ?></span></span></button>
</div>
</form>
<script type="text/javascript">
//<![CDATA[
var contactForm = new VarienForm('contactForm', true);
//]]>
</script>
Second form template(custom)should only contain email field
<form action="<?php echo $this->getFormAction(); ?>" id="contactForm" method="post" onsubmit="return custom_submit()">
<div class="fieldset">
<ul class="form-list">
<li class="fields">
<div>
<input type="hidden" name="custom" value="1" />
<label for="email" class="required"><em>*</em><?php echo $this->__('Email') ?></label>
<div class="input-box">
<input name="email" id="email" title="<?php echo $this->__('Email') ?>" class="input-text required-entry validate-email" type="text" />
</div>
</div>
</li>
</ul>
</div>
<div class="buttons-set">
<p class="required"><?php echo $this->__('* Required Fields') ?></p>
<input type="text" name="hideit" id="hideit" value="" style="display:none !important;" />
<button type="submit" title="<?php echo $this->__('Afmeld') ?>" class="button"><span><span><?php echo $this->__('Afmeld') ?></span></span></button>
</div>
</form>
Email template
{{if data.custom}}
E-mail: {{var data.email}} : Skal fjernes fra mail liste
{{else}}
Navn: {{var data.name}}
E-mail: {{var data.email}}
Telefon: {{var data.telephone}}
Besked: {{var data.comment}}
{{/if}}