Hi, Andrzej:
My codes work OK for "html", for "text", but NOT for "both". I think
EmailCompotent still has problem (email.php version 4410 under
cake_1.2.0.4451alpha). Here are codes for the  three files:

///////////////////////////////////////////
//File controllers/requests.php
//////////////////////////////////////////
class RequestsController extends AppController
{
    var $name = "Requests";
    var $uses = array(...);
    var $components = array('Email');

    function submit($id)
    {
        //save request into database.....
        //then send email alert to manager
        $this->Email->to = $this->data['AuthorizingManager']['mail'];
        $this->Email->from = $this->data['Requestor']['fullname'] . " <".
$this->data['Requestor']['mail'].">";
        $this->Email->replyTo = $this->data['Requestor']['mail'];
        $this->Email->charset = 'utf-8';
        $this->Email->sendAs = "html";
        $this->Email->template = "newRequestSubmit";
        $this->Email->subject = "New Request #".$this->data['Request']['id'].
"comes!";
        $emailResult = $this->Email->send();

        $this->set('request',$this->data);

        $this->flash('Request (#'.$id.') is created! Email Alert ='.
$emailResult, '/requests/view/'.$id);
    }
}

/////////////////////////////////////////////////////
//File views/layouts/email/html/default.ctp
////////////////////////////////////////////////////////
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html;
charset=UTF-8" />
</head>
<body>
    <div style="background:#ececec;">This test email comes from DCCC</
div>
    <div style="border: 0px solid #888;"><?php echo
$content_for_layout; ?></div>
    <div style="color:red">This E-mail is auto-generated by DCCC</div>
</body>
</html>

///////////////////////////////////////////////////////////////
//File views/elements/email/html/default.ctp
////////////////////////////////////////////////////////
Hello, a new request submitted! <br/>
<table style="...">
    <tr style="background: #e0e0e0">
        <td>URL</td>
        <td><a href="http://server/requests/view/<?php echo
$request['Request']['id']?>">http://server/requests/view/<?php echo
$request['Request']['id'] ?></a></td>
    </tr>
    <tr style="background: #ececec">
        <td>Request #</td>
        <td><?php echo $request['Request']['id'] ?></td>
    </tr>
......
</table>





On 2月12日, 下午4时38分, "thequietlab" <[EMAIL PROTECTED]> wrote:
> hi everybody,
>
> I'm kind of new to cakephp and from time to time I drown into some
> problems :)
> Now I stucked with sending emails, I tried the new EmailComponent from
> version 1.2 which is described in a bakery but somehow had problems
> with passing variables to my views, not even saying that my html
> emails didn't appear in my outlook (though I checked the html source
> and the content was there). I didn't spend to much time resolving
> these issues and just tried phpmailer, which I usually use, as
> described in bakery (btw. great resource!:)) but I had some other
> problems with layout/views mixed between those for emails and those
> for my controller action..
>
> My question is : does anybody has a working example of sending emails,
> both html and text, either through EmailComponent or any other vendor
> lib ?
>
> Thanks,
> Andrzej


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to