0

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?

2
Contributors
2
Replies
14
Views
2 Years
Discussion Span
Last Post by Ventech_IT
0

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:

Edited by cereal

0

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...

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.