Fatal error: Call to undefined method Swift::setUsername()
Posted: Sat Dec 29, 2007 4:04 pm
feyd | Please use
I run this code and I get the error:
Fatal error: Call to undefined method Swift::setUsername() in /home/sallyand/www/www/Swift-php5/testSwift.php on line 12
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hello,
Newbie to Swift and to PHP5. Done lots of non-OOP php4 and been waiting for an excuse to move up.
Anyhow, I am getting Subject errror with the very first test mail I have tried sending.
Tried my host server, then my gmail account using the code right out of your docs and keep getting undefined method messages.
I suspect I have something misconfigured but I have not searched the lib code for the functions.Code: Select all
<?php
error_reporting(E_ALL); ini_set('display_errors', true);
//Load in the files we'll need
require_once "lib/Swift.php";
require_once "lib/Swift/Connection/SMTP.php";
//Start Swift
$smtp = new Swift(new Swift_Connection_SMTP("smtp.gmail.com", Swift_Connection_SMTP::PORT_SECURE, Swift_Connection_SMTP::ENC_TLS));
$smtp->setUsername("me");
$smtp->setPassword("dontUwish");
//Create the message
$message = new Swift_Message("My subject", "My body lies over the ocean");
//Now check if Swift actually sends it
if($smtp->send($message, "folkart@berkshire.net", "howedav@gmail.com"))echo "Sent";
else echo "Failed";
?>Fatal error: Call to undefined method Swift::setUsername() in /home/sallyand/www/www/Swift-php5/testSwift.php on line 12
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]