Page 1 of 1

asmtp connection script

Posted: Thu Jan 01, 2009 11:50 am
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?

Re: asmtp connection script

Posted: Fri Jan 02, 2009 11:24 pm
by Chris Corbyn
You need to create $swift with:

Code: Select all

$swift = new Swift($smtp);