Welcome Guest, Not a member yet? Register   Sign In
How can i send email via form in CI ?

I only get email title doing this, how can i get user input message in mail as well ?
pls help

view file
<?php echo form_open_multipart('quickmail/send_quickly')?>
&lt;input type="text" value="subject" name="subject" /&gt;&lt;br /> <br />
&lt;textarea name="message" rows="15" cols="60" /&gt;&lt;/textarea><br /><br />
&lt;input type="file" name="file_name" /&gt;&lt;br /><br />
&lt;input type="submit" value="Send quick mail" /&gt;
&lt;?php echo form_close()?&gt;

controller file
function send_quickly()

        //get data
      $subject = $this->input->post('subject');
      $email = '[email protected]';
      $message = $this->input->post('message');

        $this->email->from('[email protected]', 'mycc');
        $path = '';
        $file_name = $path;
            echo "Message not sent";

What is your problem exactly? Is the mail not sent, or is it just malformed? If you are having problems, please add this line at the end of the method and show us the output.

echo $this->email->print_debugger();

i have same problem here i send the email but never found in recipen email not in spam not in anywhere any suggestion ?

siubie: Please see my previous post regarding the debugger.

thx erik trying debugger now Smile

The problem is, message body is not received in mail when i assigned it in variable ($this->email->message($message); but it's ok when i do $this->email->message('this is test mai'); Am i missing something when assigning variable ?

Backtrack. So you receive an email, though with the content missing? Use the debugger to see what is actually sent. Echo the message variable before that. Echo the post variable before that. Do all this and you'll see where things go wrong.

I'm gonna go out on a limb here and guess that you omitted form validation from your method, and if so my guess is that that's where your problem lies. In any case though, please do all the above to make sure and tell us how it goes.

It says

Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="B_ATC_4c1e1c3441d48"

This is a multi-part message in MIME format.
Your email application may not support this format.

Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

OK i am able to send message now,

any suggestion for sending attachments via mail ?

Yes, please see the user guide. It tells you how to attach files.

Theme © iAndrew 2016 - Forum software by © MyBB