Welcome Guest, Not a member yet? Register   Sign In
Good Email Form Tutorial or Code
#3

[eluser]got 2 doodle[/eluser]
@modelreject

As far as putting your mail message together I've found this technique useful
Code:
$message = $this->load->view('contents_email_cart',$data,true);

$data['user_data']= $this->userdata->get_user_data($this->user_id);
$order_email = $this->sitedata->get_site_key('order_email');
$this->email->to($order_email);
$this->email->cc($data['user_data']['email']);
$this->email->from($order_email);
$this->email->subject('Website order');
$this->email->message($message);
$this->email->send();

The first line sends the data to a view with the 'true' parameter set, in my case it's a confirmation of an online order.

Here's a chunk of the view code.
Code:
Website generated order.
<?php
$today = getdate();
$year = $today['year'];
$month = $today['month'];
$daynum = $today['mday'];
$dayname = $today['weekday'];
echo "This order was placed on $dayname, $month $daynum, $year\n";
$the_code = random_string('numeric',8)."\n";
echo "ID Number:$the_code\n\n";
//etc.

This allows an easy way to build a text message for emailing.

I know it doesn't directly answer your question and it could be considered a hack but it wasn't immediately obvious to me that you could do this in CI, now that I know you can it makes formatting the email real easy. I haven't tried it with html emails, but it should be no problem.

I thought this might save you some time.
doodle


Messages In This Thread
Good Email Form Tutorial or Code - by El Forum - 05-21-2009, 06:45 AM
Good Email Form Tutorial or Code - by El Forum - 05-21-2009, 07:12 AM
Good Email Form Tutorial or Code - by El Forum - 05-22-2009, 07:34 AM



Theme © iAndrew 2016 - Forum software by © MyBB