Hi guys

Just a quick question...I have recnetly created a contact form for my site in codeigniter and the email sends and all that but i seem to have a problem getting the $_POST data to display in the message body.

After my validation is done and the form gets posted it will only return the first variable that i place in the paranthesis like

$this->email->message($name,$email,$message);

so i was hoping someonce could show me how to construct the message body or point me to a tutorial that explains this?

Recommended Answers

All 2 Replies

the form gets posted it will only return the first variable that i place in the paranthesis like

It happens because the message() method takes only one argument. In order to work correctly you should write something like this:

$this->email->from('contact@domain.tld', 'From WebSite');
$this->email->reply_to($email, $name);
$this->email->to('me@domain.tld');
$this->email->subject('Message from contact form');
$this->email->message($message);
$this->email->send();

Important note: the from header is used to define the sender from YOUR domain, not the user that is contacting you, which instead is defined in the reply_to header, i.e. it defines the email address of your domain allowed to send emails. If you try to set the from header with the user email address, the message will be blocked or marked as spam by mail servers that will process it.

Here you can find the full documentation:

thanks for the reply cereal, i solved this by problem by setting a $data array instead of using a singel variable and then posting to a view that loads all the data...it's working proper now...also thanks for always helping out...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.