Re: sending emails question

2012-04-08 Thread heohni
Yes, ok. Thanks!
I wasn't never really aware of looking into the core files *shame*

Am Samstag, 7. April 2012 18:37:15 UTC+2 schrieb heohni:
>
> Hi,
>
> I having a newsletter registration where I want to send an email to the 
> user and to the admin.
> For now I only send to user this way:
> // send email to user to confirm
> $email = new CakeEmail();
> $email->helpers(array('Html', 'Text'));
> .
> $email->send();
>
> How do I send another email to admin now?
> Same time, but just different ->to  ->subject and body?
>
> Can I somehow reset the vars I set before to fill them with the new data 
> and send again?
>
> Thanks! And happy eastern!
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: sending emails question

2012-04-07 Thread euromark
but the code is still open source (and not encrypted) - and with a quick 
glance at its method the question would have resolved itself.
https://github.com/cakephp/cakephp/blob/2.1/lib/Cake/Network/Email/CakeEmail.php#L1079
 


Am Samstag, 7. April 2012 21:04:00 UTC+2 schrieb heohni:
>
> Because here: 
> http://book.cakephp.org/2.0/en/core-utility-libraries/email.html#CakeEmailis 
> no reset mentioned.
>
> Am Samstag, 7. April 2012 18:37:15 UTC+2 schrieb heohni:
>>
>> Hi,
>>
>> I having a newsletter registration where I want to send an email to the 
>> user and to the admin.
>> For now I only send to user this way:
>> // send email to user to confirm
>> $email = new CakeEmail();
>> $email->helpers(array('Html', 'Text'));
>> .
>> $email->send();
>>
>> How do I send another email to admin now?
>> Same time, but just different ->to  ->subject and body?
>>
>> Can I somehow reset the vars I set before to fill them with the new data 
>> and send again?
>>
>> Thanks! And happy eastern!
>>
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: sending emails question

2012-04-07 Thread heohni
Because here: 
http://book.cakephp.org/2.0/en/core-utility-libraries/email.html#CakeEmail 
is no reset mentioned.

Am Samstag, 7. April 2012 18:37:15 UTC+2 schrieb heohni:
>
> Hi,
>
> I having a newsletter registration where I want to send an email to the 
> user and to the admin.
> For now I only send to user this way:
> // send email to user to confirm
> $email = new CakeEmail();
> $email->helpers(array('Html', 'Text'));
> .
> $email->send();
>
> How do I send another email to admin now?
> Same time, but just different ->to  ->subject and body?
>
> Can I somehow reset the vars I set before to fill them with the new data 
> and send again?
>
> Thanks! And happy eastern!
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: sending emails question

2012-04-07 Thread euromark
why dont you try it out?
also - why not looking into the class and its documentation
there you would have probably found the reset() method


Am Samstag, 7. April 2012 18:37:15 UTC+2 schrieb heohni:
>
> Hi,
>
> I having a newsletter registration where I want to send an email to the 
> user and to the admin.
> For now I only send to user this way:
> // send email to user to confirm
> $email = new CakeEmail();
> $email->helpers(array('Html', 'Text'));
> .
> $email->send();
>
> How do I send another email to admin now?
> Same time, but just different ->to  ->subject and body?
>
> Can I somehow reset the vars I set before to fill them with the new data 
> and send again?
>
> Thanks! And happy eastern!
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Sending emails in console scripts

2009-04-05 Thread tekomp

This works for me...

class ExampleShell extends Shell {

var $uses = array('Example');

function main() {

App::import('Component', 'Email');
$this->Email = new EmailComponent(null);

$body = 'asdf';
$this->Email->from  = 'Example
';
$this->Email->to= 'e...@example.net';
$this->Email->subject   = 'Subject here';
$this->Email->send($body);
}
}
}
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Sending emails in console scripts

2009-04-04 Thread stain

foreach expects array or object as a first argument, so you might want
to initialize bcc as an empty array to avoid this warning

On Apr 3, 2:43 pm, "Liebermann, Anja Carolin"
 wrote:
> Note to self: All that lines are not necessary. What works is:
>
>  class ErinnerungShell extends Shell {
>         /**
>          * List of tasks for this shell
>          *
>          * @var array
>          */
>         var $tasks = array('Email');
>         var $uses = array('Vertrag');
>
>         var $Email;
>
>         function main()
>         {
>                 some code...
>         $this->emailversenden($vertrag);
>         }
>
>         function emailversenden($vertrag)
>         {
>                 $user = ;
>                 $responsibleperson = ;
>                 $responsiblepersonname = ;
>                 $responsiblepersonemail = ;
>                 $username= ;
>                 $useremail= ;
>
>                 //it looks like somehow set with compact doesn't really work 
> here
>                 $this->Email->set('user',$user);
>                 $this->Email->set('vertrag',$vertrag);
>                 $this->Email->set('responsibleperson',$responsibleperson);
>                 $this->Email->set('somemoretext',$somemoretext);
>
>                 $this->Email->settings(array(
>             'from' => 'my...@mydomain.de',
>             'template' => 'simple_message2', //this is my email layout under 
> elements
>             'to' => $responsiblepersonname.' <'.$responsiblepersonemail.'>',
>             'cc' => $username.' <'.$useremail.'>',
>             'subject' => 'Erinnerung: Vertrag kündigen 
> '.$vertrag['Lieferant']['name'],
>                 'sendAs'    => 'html'
>                 ));
>
>                 $this->Email->send();
>         }}
>
> ?>
>
> This sends me nicely formatted emails from console, although I get an 
> annoying warning :
> PHP Warning:  Invalid argument supplied for foreach() in 
> /usr/share/cake/libs/controller/components/email.php on line 457
>
> Line 457 is:
>
>         if (!empty($this->bcc) && $this->delivery != 'smtp') {
>                 $this->__header[] = 'Bcc: ' .implode(', ', 
> array_map(array($this, '__formatAddress'), $this->bcc));
>         }
> Well... Bcc is clearly empty in my setup so im am wondering where this error 
> comes from.
>
> Any hints are appreciated
>
> Anja
>
> -Ursprüngliche Nachricht-
> Von: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] Im Auftrag 
> von Liebermann, Anja Carolin
> Gesendet: Freitag, 3. April 2009 12:16
> An: cake-php@googlegroups.com
> Betreff: AW: Sending emails in console scripts
>
> Hi,
>
> I am just running into the same problem. Have you found a solution yet?
> I want to send an email via a shell script and have trouble passing teh body 
> to the Email component when using the mail functions from the example shell 
> script "my". I will now try your solution.
>
> Anja
>
> -Ursprüngliche Nachricht-
> Von: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] Im Auftrag 
> von goncalo.marr...@gmail.com
> Gesendet: Mittwoch, 21. Januar 2009 13:20
> An: CakePHP
> Betreff: Sending emails in console scripts
>
> Hi.
>
> I'm writing a console shell that needs to send emails. I want to use the 
> EmailComponent but the only way i've managed to get it to work is to manually 
> create an instance of AppController an pass it to a manually created instance 
> of EmailComponent.
>
> My code:
>
> App::import('Core', 'Controller');
> App::import('Controller', 'AppController'); $AppController = new 
> AppController(); $AppController->constructClasses();
>
> App::import('Component', 'Email');
> $Email = new EmailComponent();
> $Email->initialize($AppController);
> $Email->startup($AppController);
>
> Is there a simpler/more elegant way of achieving this? Shouldn't Shell have a 
> $components variable the same way it has a $uses variable?
>
> Thanks in advance.
>
> Gonçalo Marrafa
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Sending emails

2007-02-13 Thread jinhr

My codes works for HTML, on cake_1.2.0.4451alpha

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






This test email comes from DCCC

This E-mail is auto-generated by DCCC




//File views/elements/email/html/newRequestSubmit.ctp

Hello, a new request submitted! 


URL
http://server/requests/view/">http://server/requests/view/


Request #


..



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Sending emails

2007-02-13 Thread jinhr

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






This test email comes from DCCC

This E-mail is auto-generated by DCCC



///
//File views/elements/email/html/newRequestSubmit.ctp

Hello, a new request submitted! 


URL
http://server/requests/view/">http://server/requests/view/


Request #


..



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Sending emails

2007-02-13 Thread jinhr

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







This test email comes from DCCC

This E-mail is auto-generated by DCCC



///
//File views/elements/email/html/default.ctp

Hello, a new request submitted! 


URL
http://server/requests/view/">http://server/requests/view/


Request #


..






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 cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Sending emails

2007-02-13 Thread GreyCells

If you are using $this->Email->send('Simple email content'); then you
need to explicitly set the template to null.

See: https://trac.cakephp.org/ticket/2105

~GreyCells

(Thought I'd sent this earlier, but it didn't show up...?)


On Feb 13, 12:17 pm, "thequietlab" <[EMAIL PROTECTED]> wrote:
> @Felix : thanks, I'll try your snippet and I'll let you know
>
> @Sergei : oh man..using mail() is not really convenient when you want
> to send html + txt version, attachments etc. that's why soft like
> phpmailer or swiftmailer came out.. making our life easier :) Now I
> hope cakephp EmailComponent will make it easier as well..
>
> Thanks guys


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Sending emails

2007-02-13 Thread GreyCells

If you are using $this->Email->send('Simple email content'); then you
need to explicitly set the template to null.

See: https://trac.cakephp.org/ticket/2105

~GreyCells

(Thought I'd sent this earlier, but it didn't show up)

On Feb 13, 12:17 pm, "thequietlab" <[EMAIL PROTECTED]> wrote:
> @Felix : thanks, I'll try your snippet and I'll let you know
>
> @Sergei : oh man..using mail() is not really convenient when you want
> to send html + txt version, attachments etc. that's why soft like
> phpmailer or swiftmailer came out.. making our life easier :) Now I
> hope cakephp EmailComponent will make it easier as well..
>
> Thanks guys


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Sending emails

2007-02-13 Thread thequietlab

@Felix : thanks, I'll try your snippet and I'll let you know

@Sergei : oh man..using mail() is not really convenient when you want
to send html + txt version, attachments etc. that's why soft like
phpmailer or swiftmailer came out.. making our life easier :) Now I
hope cakephp EmailComponent will make it easier as well..

Thanks guys


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Sending emails

2007-02-12 Thread Sergei

You dont need to use any components for sending emails. Just use
mail() php function from your controller actions.

On 13 фев, 05: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


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Sending emails

2007-02-12 Thread Felix Geisendörfer
I don't have much time to explain it right now, but this is a (working) 
snippet from a project I just finished a little while ago:


$this->Email->to = '[EMAIL PROTECTED]';
$this->Email->subject = 'E-Mail from domain.com';
$this->Email->from = $this->data['EmailMessage']['name'].' 
<[EMAIL PROTECTED]>';

$this->Email->charset = 'utf8';
$this->Email->sendAs = 'html';
$this->Email->template = 'contact';
   
if (!empty($this->data['EmailMessage']['email']))
{
$this->Email->replyTo = $this->data['EmailMessage']['name'].' 
<'.$this->data['EmailMessage']['email'].'>';
}

$content = am
(
$this->data['EmailMessage']
, array
(
'ip' => $this->RequestHandler->getClientIP()
)
);

$this->Email->send($content);
$this->render('sent');


The data is available in the view via $content['ip'], $content['name'], 
etc. ...

Let me know if this helps,
-- Felix Geisendörfer aka the_undefined
--
http://www.thinkingphp.org
http://www.fg-webdesign.de


thequietlab 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 cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---