Page 1 of 1

Call to a member function setUsername

Posted: Wed Oct 31, 2007 1:39 pm
by harleyflh75
We have recently ported to php5 on a new server but keep getting this error that we didn't get with the old server

Fatal error: Call to a member function setUsername() on a non-object in /usr/local/www/vhosts/dixiechopper2008.com/httpdocs/contact.php on line 204

any ideas

Code: Select all

//Load in the files we'll need
require_once "lib/Swift.php";
require_once "lib/Swift/Connection/SMTP.php";

//Connect to SMTP (PHP5)
$swift = new Swift(new Swift_Connection_SMTP("mail.dixiechopper2008.com", 25));
$smtp->setUsername("admin@dixiechopper2008.com");
$smtp->setpassword("overtime");
 
//$smtp =& new Swift_Connection_SMTP("some-host.tld", 25);
$swift =& new Swift($smtp);
$swift2 =& new Swift($smtp);