hi,
I have problems with SS3 and swiftmailer.
With SS2.4 there are not any problems, I integrated swiftmailer this way:
In /swiftmailer/code are all swiftmailer files
/swiftmailer/_config.php
<?php
require(dirname( __FILE__ )."/code/swift_required.php");
and this is my swiftmailer class to call swiftmailer:
<?php
class SwiftMailer {
private $smtphost;
private $port;
private $user;
private $password;
private $mailer;
private $message;
private $textpart;
private $htmlpart;
public $sender;
public $receiver;
public $subject;
public $texttemplate;
public $htmltemplate;
public $templatedata;
public function __construct() {
$this->smtphost = 'localhost';
$this->port = 25;
$this->user = 'noreply@xxx';
$this->password = 'xxx';
$transport = Swift_SmtpTransport::newInstance($this->smtphost, $this->port)
->setUsername($this->user)
->setPassword($this->password);
debug::dump($transport);
if(!isset($this->sender)) {
$this->sender = array('noreply@xxx' => 'Sender Name');
}
$this->mailer = Swift_Mailer::newInstance($transport);
$this->message = Swift_Message::newInstance();
}
public function send() {
$this->message->setFrom($this->sender);
$this->message->setTo($this->receiver);
$this->message->setSubject($this->subject);
if(isset($this->templatedata) && !empty($this->templatedata)) {
$templatedata = new ArrayData($this->templatedata);
} else {
$templatedata = new ArrayData(array());
}
$this->textpart = $templatedata->renderWith($this->texttemplate);
$this->message->setBody($this->textpart);
if(isset($this->htmltemplate) && !empty($this->htmltemplate)) {
$this->htmlpart = $templatedata->renderWith($this->htmltemplate);
$this->message->addPart($this->htmlpart,'text/html');
}
$result = $this->mailer->send($this->message);
return $result;
}
}
as mentioned, this works perfect with ss2.4 but not with ss3, there are serveral swiftmailer errors like this one:
ERROR [Notice]: Undefined variable: buf
IN POST /xxx/inquiry
Line 56 in /var/www/vhosts/xxx/httpdocs/yyy/swiftmailer/code/classes/Swift/Transport/EsmtpTransport.php
so what can be the difference here? any ideas? is there anything changed in SS3 regarding to implementing 3rd party stuff?
thx