Page 1 of 1

[56K WARN] strange problem with swiftmailer

Posted: Fri Jan 05, 2007 5:00 pm
by kigoobe
Well guys

I am getting a very strange behaviour from Swift, I understand that I must be missing something, so thanks for any help.

For testing, I took a piece of text and sent a mail (to multiple recipients). On the page where I am sending the message, on printing the same, I am getting this >

Image

I sent that piece of text using tinyMCE (another wonderful open source invention like Swiftmailer) to 2 different clients, Microsoft outlook and yahoo.

Microsoft outlook is giving me the mail as >

Image

And yahoo as >

Image

Here is the full code -

Code: Select all

$objetcordo=stripslashes($objetcordo);
$themessage=stripslashes($themessage);

$themessage = eregi_replace('&','&',$themessage); 
$themessage = eregi_replace('"','"',$themessage);
$themessage = preg_replace('#<(.+?)>#ims','<\\1>',$themessage);

$sender = $prenom.' '.$nom.' <'.$email.'>';
	
require('Swift-2.1.17-php4/Swift.php');
require('Swift-2.1.17-php4/Swift/Connection/Sendmail.php');
//require('Swift_Template_Plugin.php');  

	//print 'hi3';

$connection = new Swift_Connection_Sendmail;
$mailer = new Swift($connection, $_SERVER['SERVER_NAME']);

//Container for recipients
//$recipients = array();
//$recipients[] = array($_POST['moncor']);
$recipients = $_POST['moncor'];

//print_r($recipients);


if ($mailer->isConnected())
{
    //Pass the array to send()
	
	if ($mailer -> send($recipients,$sender,$objetcordo,$themessage)) {	
	print $themessage; ?>
	<h5 align="center" style="color:#006DC6;">Mail envoyé</h5>
	<div class="taille2" style="margin-bottom:30px;">
	Bonjour <?=$prenom?> <?=$nom?><br /><br />
	Votre mail à bien été envoyé à<br /><br />
	<?php
	$language = $_POST['moncor'];
    $n = count($language);
    $i = 0;
	?>
	<div style="width:700px;align:left;">
	<?php
	echo "<ol>";
   while ($i < $n)
   {
      echo "<li>{$language[$i]}</li> \r\n";
      $i++;
   }
   echo "</ol>";
	?>
	</div>
	<br /><br />
	<a href="<?=$thelink?>.php" class="box">Retour</a>
	</div>
	<?php
	} else {
	print '<div align="center" style="color:#FF0000;font-size:21px;padding:30px 0px 50px 0px">Erreur ... veuillez essayer ultérieurement</div>';
	//print "Log: <pre>".print_r($mailer->transactions, 1)."</pre>";
	}
   	$mailer->close();
}
else echo "The mailer failed to connect. Errors: <pre>".print_r($mailer->errors, 1)."</pre><br />
	Log: <pre>".print_r($mailer->transactions, 1)."</pre>";
Any help friends?
Thanks for your time.[/img]

Posted: Fri Jan 05, 2007 5:39 pm
by Chris Corbyn

Code: Select all

$mailer -> send($recipients,$sender,$objetcordo,$themessage,"text/html")

Posted: Fri Jan 05, 2007 5:44 pm
by kigoobe
that's perfect Chris. Thanks a lot.