attempting to use swiftmailer
Posted: Wed Jun 27, 2007 10:05 pm
I'm attempting to use swiftmailer and get this error: Fatal error: Call to a member function setUsername() on a non-object in /var/www/scripts/test.php on line 9
Here is my code:
Thank you for any help.
nomb
Here is my code:
Code: Select all
<?php
//Load in the files we'll need
require_once "swift/lib/Swift.php";
require_once "swift/lib/Swift/Connection/SMTP.php";
require_once "swift/lib/Swift/Authenticator/LOGIN.php";
$conn =& new Swift_Connection_SMTP("smtp.xxxxxxxx.net");
$smtp->setUsername("xxxxxx");
$smtp->setpassword("xxxxxx");
$conn->attachAuthenticator(new Swift_Authenticator_LOGIN());
$swift =& new Swift($conn);
//Create the message
$name = $_POST["name"];
$email = $_POST["email"];
$body .= "Name: $name\n";
$body .= "Email: $email\n";
$body .= "\n";
$body .= $_POST["message"];
$message =& new Swift_Message("A new message from your website.", $body);
//Now check if Swift actually sends it
if ($swift->send($message, "webmaster@nombyte.com", "nomb85@comcast.net")) echo "Sent";
else echo "Failed";
?>nomb