email to page controller

0
98

$subject = str_replace(‘{site_name}’,$this->config->item(‘site_name’),’Contact Us Enquiry’);
$body = ”;//$content->email_content;

$verify_url = “<a href=”.base_url().”>Click here </a>”;

$customer_name = ucfirst($this->input->post(‘first_name’).” “.$this->input->post(‘last_name’));

$content = ‘<table border=”0″ style=”width:100%”>
<tbody>
<tr>
<td colspan=”2″><strong>Dear ‘.$customer_name.'</strong></td>
</tr>
<tr>
<td colspan=”2″>Enquiry&nbsp; has been submitted with following info :</td>
</tr>
<tr>
<td colspan=”2″>&nbsp;</td>
</tr>
‘;
if($this->input->post(‘first_name’)!=”)
{
$content .= ‘<tr>
<td><strong>Name:</strong></td>
<td>’.$customer_name.'</td>
</tr>’;
}
$content .= ‘<tr>
<td><strong>Email:</strong></td>
<td>’.$this->input->post(’email’).'</td>
</tr>’;
if($this->input->post(‘phone_number’)!=”)
{
$content .= ‘<tr>
<td><strong>Phone no.:</strong></td>
<td>’.$this->input->post(‘phone_number’).'</td>
</tr>’;
}

$content .= ‘<tr>
<td><strong>Mobile no.:</strong></td>
<td>’.$this->input->post(‘mobile_number’).'</td>
</tr>

<tr>
<td><strong>Comments:</strong></td>
<td>’.nl2br($this->input->post(‘message’)).'</td>
</tr>
<tr>
<td colspan=”2″>&nbsp;</td>
</tr>
<tr>
<td colspan=”2″>’.$verify_url.’ to login</td>
</tr>
</tbody>
</table>

<p><br />
Thank you.<br />
‘.$this->config->item(‘site_name’).’ Customer Service<br />
Email: ‘.$this->admin_info->admin_email.'</p>’;

$body = $content;

$mail_conf = array(
‘subject’=>$subject,
‘to_email’=>$this->input->post(’email’),
‘from_email’=>$this->admin_info->admin_email,
‘from_name’=> $this->config->item(‘site_name’),
‘body_part’=>$body
);

$this->dmailer->mail_notify($mail_conf);

/* End send mail to user */

/* Send mail to admin */

$body = $content->email_content;

$verify_url = “<a href=”.base_url().”>Click here </a>”;

$name = ‘Admin’;

$content = ‘<table border=”0″ style=”width:100%”>
<tbody>
<tr>
<td colspan=”2″><strong>Dear Admin</strong></td>
</tr>
<tr>
<td colspan=”2″>Enquiry&nbsp; has been submitted with following info :</td>
</tr>
<tr>
<td colspan=”2″>&nbsp;</td>
</tr>’;
if($this->input->post(‘first_name’)!=”)
{
$content .= ‘<tr>
<td><strong>Name:</strong></td>
<td>’.$customer_name.'</td>
</tr>’;
}
$content .= ‘<tr>
<td><strong>Email:</strong></td>
<td>’.$this->input->post(’email’).'</td>
</tr>’;
if($this->input->post(‘phone_number’)!=”)
{
$content .= ‘<tr>
<td><strong>Phone no.:</strong></td>
<td>’.$this->input->post(‘phone_number’).'</td>
</tr>’;
}

$content .= ‘<tr>
<td><strong>Mobile no.:</strong></td>
<td>’.$this->input->post(‘mobile_number’).'</td>
</tr>

<tr>
<td><strong>Comments:</strong></td>
<td>’.nl2br($this->input->post(‘message’)).'</td>
</tr>
<tr>
<td colspan=”2″>&nbsp;</td>
</tr>
<tr>
<td colspan=”2″>’.$verify_url.’ to login</td>
</tr>
</tbody>
</table>

<p><br />
Thank you.<br />
‘.$this->config->item(‘site_name’).’ Customer Service<br />
Email: ‘.$this->admin_info->admin_email.'</p>’;

$body = $content;

$mail_conf = array(
‘subject’=>$subject,
‘to_email’=>$admin_email,
‘from_email’=>$this->admin_info->admin_email,
‘from_name’=> $this->config->item(‘site_name’),
‘body_part’=>$body
);

$this->dmailer->mail_notify($mail_conf);