macagua / example-yii-mail

Automatically exported from code.google.com/p/yii-mail
BSD 3-Clause "New" or "Revised" License
0 stars 2 forks source link

Some small error in Mail.php #1

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Line 207:
$this->transport = Swift_SmtpTransport::newInstance();

Remove new.. as this function is called statically

line 236 / 239:
require 
YiiBase::getPathOfAlias('application').'/vendors/swiftMailer/classes/Swift.php';
Yii::registerAutoloader(array('Swift','autoload'));
require 
YiiBase::getPathOfAlias('application').'/vendors/swiftMailer/swift_init.php';

These files should not come from current component directory but the vendor 
directory ;)

Also Message could cause conflicts with autloading as it is a very general 
class name.. Refactor to MailMessage would be nicer i think.

Original issue reported on code.google.com by chris.de...@gmail.com on 17 Jun 2010 at 4:32

GoogleCodeExporter commented 9 years ago
This three separate issues:

    Line 207:
    $this->transport = Swift_SmtpTransport::newInstance();

    Remove new.. as this function is called statically

I'm not sure I understand this one.  The code mentioned looks correct in the 
repository.

    line 236 / 239:
    require YiiBase::getPathOfAlias('application').'/vendors/swiftMailer/classes/Swift.php';
    Yii::registerAutoloader(array('Swift','autoload'));
    require YiiBase::getPathOfAlias('application').'/vendors/swiftMailer/swift_init.php';

    These files should not come from current component directory but the vendor directory ;)

Makes sense, but for ease of deployment it's nice to have SwiftMailer in the 
extension directory.  Maybe the path should be a configuration option?

    Also Message could cause conflicts with autloading as it is a very general class name.. Refactor to MailMessage would be nicer i think.

This is fixed in r5.  "Message" is now "YiiMailMessage".

Original comment by the.matt...@gmail.com on 9 Nov 2010 at 9:50