Page 1 of 1

Reg:SwiftMailer Send Error

Posted: Fri Jun 29, 2007 4:30 am
by esther
I have downloaded SwiftMailer Plugin But I cannot send mails.The error is
Fatal error: Call to undefined method Swift_Connection_SMTP::send()
I dont understand the error.Please give me a solution

Posted: Fri Jun 29, 2007 5:04 am
by John Cartwright
We need to see the code to help you, however I think you should take a look at the documentation, as you'll see the Swift_Connection_SMTP object is not the object you should be calling send() from :wink:

Posted: Fri Jun 29, 2007 6:51 am
by feyd
Accidentally posted to a new thread:
esther wrote:Hello Sir,
Below is the code that i gave

Code: Select all

require_once "lib/Swift.php";
require_once "lib/Swift/Message.php";
require_once "lib/Swift/Connection.php";
require_once "lib/Swift/Message/Attachment.php";
//require_once "lib/Swift/Connection/Multi.php";
//require_once "lib/Swift/Connection/SMTP.php";
require_once "lib/Swift/Connection/Sendmail.php";

$swift=& new Swift_Connection_Sendmail("localhost");
$message =& new Swift_Message("My subject", "sdfsdf");
$swift->send($message, "xxx@yahoo.com", "esther@gmail.com");
echo "Sent to $sent recipients";
But i got a error in send() function.

Posted: Fri Jun 29, 2007 12:51 pm
by Chris Corbyn
Have I got an error in my docs or something? Everyone seems to be making this mistake lately :?

Code: Select all

$swift =& new Swift($sendmail);
You *always* need to create an instance of Swift otherwise there's nothing controlling the connection ;) The connections are just that -- connections.