Page 1 of 1

'LOG_EVERYTHING' error

Posted: Tue Jan 15, 2008 1:37 am
by moultan
Hello just a quick question to the board, (Swift Mail)

I can run mail from my local machine fine:

Code: Select all

require_once "lib/Swift.php";
require_once "lib/Swift/Connection/SMTP.php";
 
//Start Swift
$smtp =& new Swift_Connection_SMTP("mail.bigpond.com", 25);
//$smtp = new Swift_Connection_SMTP("mail.bigpond.com", Swift_Connection_SMTP::PORT_SECURE, Swift_Connection_SMTP::ENC_TLS);
 
 
$smtp->setUsername("matthewlaity");
$smtp->setpassword("xxxxxx");
 
$swift =& new Swift($smtp);
 
 
 
//Create the message
$message =& new Swift_Message("My subject", "My body");
 
//Now check if Swift actually sends it
if ($swift->send($message, "matthew.laity@gmail.com", "me@mydomain.com")) echo "Sent";
else echo "Failed";
But as soon as I load up to my host running PHP 5.2 get this error:
Fatal error: Undefined class constant 'LOG_EVERYTHING' in /home/glo15624/public_html/lib/Swift.php on line 100

Re: 'LOG_EVERYTHING' error

Posted: Tue Jan 15, 2008 3:04 am
by Chris Corbyn
What version of Swift Mailer are you using?

Re: 'LOG_EVERYTHING' error

Posted: Tue Jan 15, 2008 6:04 am
by moultan
I'm using 3.3.2.

.... hows its going in Melbs mate .... me from Melbourne too maybe you can come around to my house and help here ... lol


thanks.

Re: 'LOG_EVERYTHING' error

Posted: Tue Jan 15, 2008 6:53 am
by Chris Corbyn
moultan wrote:I'm using 3.3.2.

.... hows its going in Melbs mate .... me from Melbourne too maybe you can come around to my house and help here ... lol


thanks.
Going great thanks (except I seem to be battling mosquitos tonight!). Just working in Collingwood and living in Maribyrnong right now. Looking forward to doing some travelling around later this year.

I just checked that line, the cross referenced the Swit_Log class and it's definitely there which is odd. I wonder if PHP's doing something weird with the way it's including the log file.

Out of curiosity, does adding this line above your require_once 'lib/Swift.php'; fix it?

Code: Select all

require_once "lib/Swift/Log.php";

Re: 'LOG_EVERYTHING' error

Posted: Wed Jan 16, 2008 12:52 am
by moultan
nar no luck there, same response.

I've tried send gmail and through there own servers, and now i'am using my own personal mail server with my ISP.

I've just submitted a ticket to my web host asking if they have any ideas. Maybe there've done something stupid with there php config , lets see how that goes.

Re: 'LOG_EVERYTHING' error

Posted: Wed Jan 16, 2008 1:02 am
by Chris Corbyn
Can you post the contents of what's inside the file you see (on the server with the problem) at ;ib/Swift/Log.php. If you recently upgraded Swift it's possible that this file never got overwritten or something.

Re: 'LOG_EVERYTHING' error

Posted: Wed Jan 16, 2008 1:21 am
by moultan
ok....

Code: Select all

<?php
 
/**
 * Swift Mailer Logging Layer base class.
 * Please read the LICENSE file
 * @author Chris Corbyn <chris@w3style.co.uk>
 * @package Swift_Log
 * @license GNU Lesser General Public License
 */
 
if (!defined("SWIFT_LOG_COMMAND")) define("SWIFT_LOG_COMMAND", ">>");
if (!defined("SWIFT_LOG_RESPONSE")) define("SWIFT_LOG_RESPONSE", "<<");
if (!defined("SWIFT_LOG_ERROR")) define("SWIFT_LOG_ERROR", "!!");
if (!defined("SWIFT_LOG_NORMAL")) define("SWIFT_LOG_NORMAL", "++");
if (!defined("SWIFT_LOG_NOTHING")) define("SWIFT_LOG_NOTHING", 0);
if (!defined("SWIFT_LOG_ERRORS")) define("SWIFT_LOG_ERRORS", 1);
if (!defined("SWIFT_LOG_FAILURES")) define("SWIFT_LOG_FAILURES", 2);
if (!defined("SWIFT_LOG_NETWORK")) define("SWIFT_LOG_NETWORK", 3);
if (!defined("SWIFT_LOG_EVERYTHING")) define("SWIFT_LOG_EVERYTHING", 4);
 
/**
 * The Logger class/interface.
 * @package Swift_Log
 * @author Chris Corbyn <chris@w3style.co.uk>
 */
class Swift_Log
{
  /**
   * A command type entry
   */
  var $COMMAND = ">>";
  /**
   * A response type entry
   */
  var $RESPONSE = "<<";
  /**
   * An error type entry
   */
  var $ERROR = "!!";
  /**
   * A standard entry
   */
  var $NORMAL = "++";
  /**
   * Logging is off.
   */
  var $LOG_NOTHING = 0;
  /**
   * Only errors are logged.
   */
  var $LOG_ERRORS = 1;
  /**
   * Errors + sending failures.
   */
  var $LOG_FAILURES = 2;
  /**
   * All SMTP instructions + failures + errors.
   */
  var $LOG_NETWORK = 3;
  /**
   * Runtime info + SMTP instructions + failures + errors.
   */
  var $LOG_EVERYTHING = 4;
  /**
   * Failed recipients
   * @var array
   */
  var $failedRecipients = array();
  /**
   * The maximum number of log entries
   * @var int
   */
  var $maxSize = 50;
  /**
   * The level of logging currently set.
   * @var int
   */
  var $logLevel = SWIFT_LOG_NOTHING;
  
  /**
   * Add a new entry to the log
   * @param string The information to log
   * @param string The type of entry (see the constants: COMMAND, RESPONSE, ERROR, NORMAL)
   */
  function add($text, $type = SWIFT_LOG_NORMAL) {}
  /**
   * Dump the contents of the log to the browser.
   * @param boolean True if the string should be returned rather than output.
   */
  function dump($return_only=false) {}
  /**
   * Empty the log contents
   */
  function clear() {}
  /**
   * Check if logging is enabled.
   */
  function isEnabled()
  {
    return ($this->logLevel > $this->LOG_NOTHING);
  }
  /**
   * Add a failed recipient to the list
   * @param string The address of the recipient
   */
  function addFailedRecipient($address)
  {
    $this->failedRecipients[$address] = null;
    $this->add("Recipient '" . $address . "' rejected by connection.", $this->ERROR);
  }
  /**
   * Get the list of failed recipients
   * @return array
   */
  function getFailedRecipients()
  {
    return array_keys($this->failedRecipients);
  }
  /**
   * Set the maximum size of this log (zero is no limit)
   * @param int The maximum entries
   */
  function setMaxSize($size)
  {
    $this->maxSize = (int) $size;
  }
  /**
   * Get the current maximum allowed log size
   * @return int
   */
  function getMaxSize()
  {
    return $this->maxSize;
  }
  /**
   * Set the log level to one of the constants provided.
   * @param int Level
   */
  function setLogLevel($level)
  {
    $level = (int)$level;
    $this->add("Log level changed to " . $level, $this->NORMAL);
    $this->logLevel = $level;
  }
  /**
   * Get the current log level.
   * @return int
   */
  function getLogLevel()
  {
    return $this->logLevel;
  }
  /**
   * Check if the log level includes the one given.
   * @param int Level
   * @return boolean
   */
  function hasLevel($level)
  {
    return ($this->logLevel >= ((int)$level));
  }
}
Do you think I should be looking at my host php settings ??

Re: 'LOG_EVERYTHING' error

Posted: Wed Jan 16, 2008 2:30 am
by Chris Corbyn
Not your hosts settings.... that file is the PHP4 version, yet the Swift.php file you have is the PHP5 version. Have you switched versions somewhere along the way? It's not packaged like that so it wouldn't be possible for you to have that mix-up without downloading two separate archives and getting the files muddled up somewhere along the way ;) Delete all the files and re-upload a fresh copy :)

Re: 'LOG_EVERYTHING' error

Posted: Thu Jan 17, 2008 1:14 am
by moultan
oh mate thats it... thanks I owe you a cold one.

:D