I originally found code on the Bakery:
http://bakery.cakephp.org/articles/view/phpmailer-with-native-api-for-php-5-x
http://bakery.cakephp.org/articles/view/94
I do not know how to send via Gmail because I use a different SMTP
service.
For a very simple example, I have included a controller function
below, but you are much better referring to the Bakery articles and
comments for more complete information:
function _sendEmail($email, $subject, $body) {
// next line enables you to test the function if debug is
turned on...
if (Configure::read('debug') >0 ) $email =
'villas11@gmail.com';
$this->Mailer->startup();
$this->Mailer->From = "info@yourdomain.com" ;
$this->Mailer->FromName = 'MyFullName' ;
$this->Mailer->Subject = $subject;
$this->Mailer->AltBody = $body;
$this->Mailer->Body = nl2br($body);
$this->Mailer->AddAddress($email, "");
if(!$this->Mailer->send())
{
$this->Session->setFlash(__('Email Error - inform
test@yourdomain.com of the problem: '.$this->Mailer->ErrorInfo,
true));
}
}
On Sep 15, 1:59 pm, mario <marioqta...@gmail.com> wrote:
> Hi villas,
>
> Can you give a snippet of your controller code? I'm planning to use
> gmail as my smtp server.
> It would be nice if I can see how the email component is setup in the
> controller(especially using gmail smtp server).
>
> Thanks villas.
>
> On Sep 15, 3:17 am, villas <villa...@gmail.com> wrote:
>
> > If you do have any further trouble with SwiftMailer, you could also
> > try phpMailer which I managed to get working in very little time using
> > an article from the Bakery. From what I have heard, SwiftMailer is
> > technically superior; but my happy experience using phpMailer makes
> > me think that it cannot be far behind.
>
> > On Sep 15, 8:18 am, mario <marioqta...@gmail.com> wrote:
>
> > > Hello everyone,
>
> > > I want to implement an email feature in my cakephp app and I want to
> > > use the gmail smtp server.
> > > I've come across this SwiftMailer Component and I've seen that it was
> > > updated last Dec 18, 2006.
>
> > > Here is the link:http://bakery.cakephp.org/articles/view/swiftmailer-component-tutorial
>
> > > Has anyone of you tried using this component in the latest build
> > > version of cakephp(1.2.x.x)?
>
> > > Follow-up question:
>
> > > I'm currently developing my cakephp app in my local machine and it is
> > > not yet uploaded in the
> > > web server. Furthermore, my machine is connected to the internet. So
> > > my question is, can you implement/test
> > > the email component of cakephp on your localhost (example: email
> > > sending via gmail smtp server)?
>
> > > Thanks in advance,
>
> > > Mario
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---
No comments:
Post a Comment