[eluser]arylaarsdam[/eluser]
My apologies for not posting the actual code. I wrote this from work thinking I could get to my code from there, but I couldn't. This is controller that processes my email form. Like I said, the email sends successfully. However, the resulting page that shows in the browser shows all the email credentials I have set in my email.php config file.
Code:
function contact_seller() {
$this->load->library('form_validation');
//field name, error message, validation rules
$this->form_validation->set_rules('potential_customer_name', 'Name', 'trim|required');
$this->form_validation->set_rules('potential_customer_message', 'Message', 'trim|required');
$this->form_validation->set_rules('potential_customer_email', 'Email Address', 'trim|required|valid_email');
$this->form_validation->set_rules('potential_customer_phone', 'Phone Number', 'valid_phone_number_or_empty');
$this->form_validation->set_message('valid_phone_number_or_empty', 'The %s you provided is invalid. Please use the format (###) ###-####.');
if($this->form_validation->run() == FALSE)
{
$this->index($this->session->userdata('lastviewedproperty'));
}
else
{
$this->load->library('email');
$this->email->from('[email protected]', 'Customer Contact');
$this->email->to($this->input->post('seller_email'));
$this->email->subject('Contact from potential customer '.$this->input->post('potential_customer_name'));
$this->email->message('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html >
<head>
<meta http-equiv="Content-Type" c charset=UTF-8" />
<title>Title Here</title>
<style>
body{font-family:Arial, Helvetica, sans-serif;font-size:24px;color:#50330a}.text_body{padding-left:20px;padding-right:20px;font-weight:lighter;margin-top:0px;font-size:.8em;text-shadow:0px 3px 5px rgba(186, 157, 119, 0.59)}.text_subtitle{font-stretch:expanded;font-weight:bold;text-shadow:0px 3px 5px rgba(186, 157, 119, 0.59)}.text_comingsoon{font-weight:bold;font-size:2em;text-shadow:0px 3px 5px rgba(186, 157, 119, 0.59)}
</style>
</head>
<body>
<div class="page_container">
<div class="page_body">
<div class="text_subtitle">
'.$this->input->post('potential_customer_name').' Is Interested In Your Listing!
</div>
<div class="text_body">
<p>'.$this->input->post('potential_customer_name').' | '.$this->input->post('seller_email').' | '.$this->input->post('potential_customer_phone').'</p>
<p>'.$this->input->post('potential_customer_message').'</p>
</div>
</div>
</div>
</body>
</html>');
$this->email->set_mailtype("html");
if($this->email->send() == TRUE)
{
$this->index($this->session->userdata('lastviewedproperty'));
}
}
}
The resulting page shows this at the top of the page:
$config['protocol'] = 'smtp'; $config['smtp_host'] = 'ssl://SMTPSERVERINFOHERE'; $config['smtp_user'] = 'SMTPUSERINFOHERE'; $config['smtp_pass'] = 'SMTPPASSWORDHERE'; $config['smtp_port'] = '465'; $config['mailtype'] = 'html'; $config['charset'] = 'utf-8';
A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at /home1/abcdefg/public_html/2013dev/application/config/email.php:7)
Filename: libraries/Session.php
Line Number: 675
Lastly, here is the code from my email.php config file:
Code:
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://SMTPSERVERINFOHERE';
$config['smtp_user'] = 'SMTPUSERINFOHERE';
$config['smtp_pass'] = 'SMTPPASSWORDHERE';
$config['smtp_port'] = '465';
$config['mailtype'] = 'html';
$config['charset'] = 'utf-8';
Any thoughts on why the email credentials are displayed at the top of the subsequent page after the email sends? Any thoughts on how to properly display a message that either says 'Email sent successfully' or 'Email did not send, please try again later'?
Thank you!