[NFR] Mail component
I would like to see a Mail component in the framework.
The component encapsulate sending mail over Sendmail (linux) or SMTP with local/remote connections.
from to message headers cc bcc attachments
should be considered as core.
This requirement is scheduled for 0.6.0
Mail component can be inspired by CakeEmail component. Easy to use and understand, not complicated (like Symfony one)
See: http://book.cakephp.org/2.0/en/core-utility-libraries/email.html
On c it will work much more faster, also if it will be native framework solution, it will be much easier. Perhaps, it could be less priority component, but if implementation will be nice (we have many examples to overview before start) - i would use it (i suppose many other users will too).
In my opinion Mail component currently not required for phalcon. There is a lot of library component for this job. One of this library is \Zend\Mail
The library very useful with DI.
<?php
$di = new \Phalcon\DI\FactoryDefault();
$di->set('mail', function() {
return new \Zend\Mail\Transport\Sendmail();
}, true);
$mail = new \Zend\Mail\Message();
$mail->setBody('This is the text of the email.');
$mail->setFrom('[email protected]', 'Sender\'s name');
$mail->addTo('[email protected]', 'Name o. recipient');
$mail->setSubject('TestSubject');
$di->get('mail')->send($mail);
Perhaps you could look at the Ruby on Rails implementation on sending emails. E-mails are a lot like controllers, handling data and views and linking the two. I would love to see this implemented in Phalcon:
http://guides.rubyonrails.org/action_mailer_basics.html
@tugrul Zend is VERY heavy library, it's not good practice to import all Zend into project just because of it's mail component (otherwise you will have big workaroung filtering out required files).
Anyway, zend implementation is very nice, except some little bugs.
Yup, till nowdays, there is no standalone php mail library following PSR standards.. We're waiting for this component very much :)
@avasin you are partially right. You don't need import every component of Zend to use Mail component. Zend Framework 2 seperated modules for each different tasks. I hate the Application model of Zend Framework 1 and 2 but Mail component is good part of Zend Framework 2.
For me PHPMailer is good enough.
:+1: My favorite is Zend Mail or swiftmail in this order
Well, for me the best library to sending emails is http://swiftmailer.org . Stable, good documentation, simple to use.
PHPMailer is not psr-compatible. Don't remember if swiftmailer is.
:+1:
As for me, mail component is not needed inside of the core.
+1
Nowadays, you have swiftmailer which is great but too heavy. This addition could make phalconphp the best framework for applications demanding huge usage of mailing.
+1
-1 becase I'm agree with @tugrul
Mail component currently not required for phalcon. There is a lot of library component for this job.
It's better to focus on other issues
After further discussion, we decided not to pursue this issue for the time being.
The reason behind this is that a mail component has very little to gain from Phalcon. Once you have your content, you just set it up in the object and from then on it is all network traffic i.e. connect to the other server, transfer the email and close the connection.
Applications mentioned here as swiftmailer, phpmailer or any other can easily be included in our applications for the purpose of sending emails.
Perhaps in the future we might tackle this again but for the time being we will concentrate our efforts on other issues.