Skip to content

Commit

Permalink
Improved some exception typing and updated TODO
Browse files Browse the repository at this point in the history
  • Loading branch information
d11wtq committed Feb 22, 2008
1 parent de5f2f9 commit e5dc85c
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 7 deletions.
5 changes: 5 additions & 0 deletions TODO
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ Swift Mailer SE:
----------------

* Write some sanity tests
* $message->addHeader(MimeFactory::create('header')->setValue('bar'))
* $message->removeHeader('X-Foo')
* $event = $this->_eventDispatcher->createEvent('send');
$event->setMessage($message);
$this->_eventDispatcher->dispatchEvent($event);
* CharacterReaderFactory (map charsets to CharacterReaders).
- Big5
- Shift-JIS
Expand Down
2 changes: 1 addition & 1 deletion lib/classes/Swift/Transport/Esmtp/AuthHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public function setKeywordParams(array $parameters)
*/
public function afterEhlo(Swift_Transport_EsmtpBufferWrapper $buf)
{
if (isset($this->_username))
if ($this->_username)
{
$count = 0;
foreach ($this->_authenticators as $authenticator)
Expand Down
5 changes: 3 additions & 2 deletions lib/classes/Swift/Transport/EsmtpTransport.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
//@require 'Swift/Transport/IoBuffer.php';
//@require 'Swift/Transport/EsmtpBufferWrapper.php';
//@require 'Swift/Transport/CommandSentException.php';
//@require 'Swift/Transport/TransportException.php';
//@require 'Swift/Mime/Message.php';

/**
Expand Down Expand Up @@ -451,7 +452,7 @@ private function _assertResponseCode($response, $wanted)
list($code, $separator, $text) = sscanf($response, '%3d%[ -]%s');
if (!empty($wanted) && !in_array($code, $wanted))
{
throw new Exception(
throw new Swift_Transport_TransportException(
'Expected response code ' . implode('/', $wanted) . ' but got code ' .
'"' . $code . '", with message "' . $response . '"'
);
Expand Down Expand Up @@ -603,7 +604,7 @@ private function _doMailTransaction($message, $reversePath, array $recipients)
);
$sent++;
}
catch (Exception $e)
catch (Swift_Transport_TransportException $e)
{
}
}
Expand Down
5 changes: 4 additions & 1 deletion test-suite/helpers/Swift/Tests/SwiftSmokeTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ protected function _getMailer()
case 'smtp':
$transport = Swift_TransportFactory::create('smtp')
->setHost(SWIFT_SMOKE_SMTP_HOST)
->setPort(SWIFT_SMOKE_SMTP_PORT); //username/password
->setPort(SWIFT_SMOKE_SMTP_PORT)
->setUsername(SWIFT_SMOKE_SMTP_USER)
->setPassword(SWIFT_SMOKE_SMTP_PASS)
;
break;
default:
throw new Exception('Undefined transport [' . SWIFT_SMOKE_TRANSPORT_TYPE . ']');
Expand Down
4 changes: 2 additions & 2 deletions tests/smoke.conf.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
Defines: The an address which Swift can send to (it will also send "from" this address).
Recommended: (your own email address?)
*/
define('SWIFT_SMOKE_EMAIL_ADDRESS', 'chris@w3style.co.uk');
define('SWIFT_SMOKE_EMAIL_ADDRESS', 'chris[email protected]');

/*
Defines: The specific transport you want to mail with.
Expand All @@ -28,7 +28,7 @@
Defines: An SMTP server to connect to
Recommended: smtp.your-isp.com (varies wildly!)
*/
define('SWIFT_SMOKE_SMTP_HOST', 'mail.bigpond.com.au');
define('SWIFT_SMOKE_SMTP_HOST', 'gmail-smtp-in.l.google.com');

/*
Defines: The SMTP port to connect to
Expand Down
2 changes: 1 addition & 1 deletion tests/smoke/Swift/Smoke/BasicSmokeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function testBasicSending()
$this->assertEqual(1, $mailer->send($message),
'%s: The smoke test should send a single message'
);
$this->_visualCheck('basic.jpg');
$this->_visualCheck('http://swiftmailer.org/smoke/4.0.0/basic.jpg');
}

}

0 comments on commit e5dc85c

Please sign in to comment.