asmtp connection script

Swift Mailer is a fantastic library for sending email with php. Discuss this library or ask any questions about it here.

Moderators: Chris Corbyn, General Moderators

Post Reply
ivoht
Forum Newbie
Posts: 1
Joined: Thu Jan 01, 2009 11:39 am

asmtp connection script

Post by ivoht »

hi there,

because my provider requests asmtp (http://strato-faq.nl/view.php4?articleid=147)
i changed the script to;

require_once "lib/Swift.php";
require_once "lib/Swift/Connection/SMTP.php";

$smtp =& new Swift_Connection_SMTP("smtp.strato.com", 25); //mostly localhost
$smtp->setUsername("webmaster@xxxx.nl");
$smtp->setPassword("xxxxx");
$message =& new Swift_Message("Huren carnavalswagen", $message, "text/html");

if ($swift->send($message, "info@xxxx.nl", "webmaster@xxxxnl"))
{
echo "Bedankt. U krijgt zo spoedig mogelijk reactie.";
}
else
{
echo "Om technische redenen is er geen mail verstuurd. Stuur ons een mail naar xxx@xxx.nl";
}
$swift->disconnect();


But now i get the nect error;
Fatal error: Call to a member function send() on a non-object in /mnt/web8/50/87/51957987/htdocs/Praalwagens/post.php on line 115

What did i do wrong?
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: asmtp connection script

Post by Chris Corbyn »

You need to create $swift with:

Code: Select all

$swift = new Swift($smtp);
Post Reply