failed with the first example - please help
Posted: Wed Feb 25, 2009 7:47 pm
I tried the example provided in the readme, but it fails for me. I used version 3 on many projects, I love it! At first glance version 4 seems to be very cool, neat n clear syntax. Grat!
I'm moving all my sites to a new server (with fastcgi), and this caused problems with ver3. I'd like to switch to ver4.
This is the error I get. See my code below.
FastCGI: server "/usr/php5fcgi/bin/php-cgi-suhosin" stderr: PHP Catchable fatal error: Argument 1 passed to Swift_Transport_EsmtpTransport::__construct() must implement interface Swift_Transport_IoBuffer, none given in /data/domains/ossejtterapia.hu/web/webroot/swift/lib/classes/Swift/Transport/EsmtpTransport.php on line 74
require_once 'swift/lib/swift_required.php';
$smtp = Swift_SmtpTransport::newInstance('smtp.myserver.net', 25)
->setUsername('...')
->setPassword('...');
$mailer = Swift_Mailer::newInstance($smtp);
$message = Swift_Message::newInstance('Your subject');
$message->setTo('balho@wer.net')
->setFrom('mai@osse.hu')
->setBody(
'Here is an image ',
'text/html'
)
->addPart('This is the alternative part','text/plain')
;
if ($mailer->send($message))
{echo "Message sent!";
}
else
{echo "Message could not be sent.";
}
What am I doing wrong?
Thanks in advance,
Balazs
I'm moving all my sites to a new server (with fastcgi), and this caused problems with ver3. I'd like to switch to ver4.
This is the error I get. See my code below.
FastCGI: server "/usr/php5fcgi/bin/php-cgi-suhosin" stderr: PHP Catchable fatal error: Argument 1 passed to Swift_Transport_EsmtpTransport::__construct() must implement interface Swift_Transport_IoBuffer, none given in /data/domains/ossejtterapia.hu/web/webroot/swift/lib/classes/Swift/Transport/EsmtpTransport.php on line 74
require_once 'swift/lib/swift_required.php';
$smtp = Swift_SmtpTransport::newInstance('smtp.myserver.net', 25)
->setUsername('...')
->setPassword('...');
$mailer = Swift_Mailer::newInstance($smtp);
$message = Swift_Message::newInstance('Your subject');
$message->setTo('balho@wer.net')
->setFrom('mai@osse.hu')
->setBody(
'Here is an image ',
'text/html'
)
->addPart('This is the alternative part','text/plain')
;
if ($mailer->send($message))
{echo "Message sent!";
}
else
{echo "Message could not be sent.";
}
What am I doing wrong?
Thanks in advance,
Balazs