Milad
06-15-2008, 10:00 PM
By Syrian Medical Society (http://www.syrianmeds.net/) & Milad (http://www.milado.net/)
Introduction:
In order to solve the problem with unicode (UTF-8) in some Email Service Providers (such as Hotmail, Yahoo and many others), I created this product.
It converts the sent out messages only, from your real encoding into an encoding of choice, both encodings, the source & destination must be supported by iconv (http://www.gnu.org/software/libiconv/#introduction).
You may know, I had converted to UTF-8 and faced this problem, now it's solved.
Caution:
This product is provided As Is without warranties.
Requirements:
vBulletin 3.7.1+
iconv PHP extension is installed on your system, or your PHP version is 5 and above.
Supported Encodings:
See http://www.gnu.org/software/libiconv/#introduction
Installation or Upgrading:
Import the product file product-vmail_converter.xml (Choose Yes when Upgrade).
Go to vBulletin Options -> Email Options -> vMail Converter - Destination Encoding.
Set your Destination Encoding and save (For me, It's windows-1256).
In /includes/class_mail.php Replace every
$stylevar['charset']
WITH
$this->get_charset()
In /includes/class_mail.php Replace every
$vbulletin->options['bbtitle']
WITH
$this->converted_bbtitle()
In /includes/class_mail.php Find
$toemail = $this->fetch_first_line($toemail);
Add after:
// vMail Converter START
$subject = $this->vmail_convert($subject);
$message = $this->vmail_convert($message);
if ($from != '')
{
$from = $this->vmail_convert($from);
}
if ($uheaders != '')
{
$uheaders = $this->vmail_convert($uheaders);
}
if ($username != '')
{
$username = $this->vmail_convert($username);
}
// vMail Converter END
In /includes/class_mail.php Find again
function start($toemail, $subject, $message, $from = '', $uheaders = '', $username = '')
{
Add before:
// vMail Converter START
function vmail_convert($item)
{
global $stylevar;
if (function_exists('iconv') AND $item != '')
{
return @iconv($stylevar['charset'], $this->registry->options['vmail_converter_destination'], $item);
}
else
{
return $item;
}
}
function get_charset()
{
global $stylevar;
if (function_exists('iconv'))
{
return $this->registry->options['vmail_converter_destination'];
}
else
{
return $stylevar['charset'];
}
}
function converted_bbtitle()
{
global $vbulletin;
return $this->vmail_convert($vbulletin->options['bbtitle']);
}
// vMail Converter END
Find:
if (isset($vbphrase['x_mailer']))
{
Add After:
$vbphrase['x_mailer'] = $this->vmail_convert($vbphrase['x_mailer']);
Save and upload the file again.
You're done.
Known issues:
none.
Versions:
1.0.0 (initial release). (5. April 2007)
1.1.0 (10. April 2007)
1.1.1 (11. April 2007) fix a bug
1.2.0 (17. May 2007) Very good version, every bug fixed.
1.3.0 (16 June 2008) Version for 3.7.1
Support is given for who clicks "install" only.
Mark it as "Installed" to receive updates and support.
Introduction:
In order to solve the problem with unicode (UTF-8) in some Email Service Providers (such as Hotmail, Yahoo and many others), I created this product.
It converts the sent out messages only, from your real encoding into an encoding of choice, both encodings, the source & destination must be supported by iconv (http://www.gnu.org/software/libiconv/#introduction).
You may know, I had converted to UTF-8 and faced this problem, now it's solved.
Caution:
This product is provided As Is without warranties.
Requirements:
vBulletin 3.7.1+
iconv PHP extension is installed on your system, or your PHP version is 5 and above.
Supported Encodings:
See http://www.gnu.org/software/libiconv/#introduction
Installation or Upgrading:
Import the product file product-vmail_converter.xml (Choose Yes when Upgrade).
Go to vBulletin Options -> Email Options -> vMail Converter - Destination Encoding.
Set your Destination Encoding and save (For me, It's windows-1256).
In /includes/class_mail.php Replace every
$stylevar['charset']
WITH
$this->get_charset()
In /includes/class_mail.php Replace every
$vbulletin->options['bbtitle']
WITH
$this->converted_bbtitle()
In /includes/class_mail.php Find
$toemail = $this->fetch_first_line($toemail);
Add after:
// vMail Converter START
$subject = $this->vmail_convert($subject);
$message = $this->vmail_convert($message);
if ($from != '')
{
$from = $this->vmail_convert($from);
}
if ($uheaders != '')
{
$uheaders = $this->vmail_convert($uheaders);
}
if ($username != '')
{
$username = $this->vmail_convert($username);
}
// vMail Converter END
In /includes/class_mail.php Find again
function start($toemail, $subject, $message, $from = '', $uheaders = '', $username = '')
{
Add before:
// vMail Converter START
function vmail_convert($item)
{
global $stylevar;
if (function_exists('iconv') AND $item != '')
{
return @iconv($stylevar['charset'], $this->registry->options['vmail_converter_destination'], $item);
}
else
{
return $item;
}
}
function get_charset()
{
global $stylevar;
if (function_exists('iconv'))
{
return $this->registry->options['vmail_converter_destination'];
}
else
{
return $stylevar['charset'];
}
}
function converted_bbtitle()
{
global $vbulletin;
return $this->vmail_convert($vbulletin->options['bbtitle']);
}
// vMail Converter END
Find:
if (isset($vbphrase['x_mailer']))
{
Add After:
$vbphrase['x_mailer'] = $this->vmail_convert($vbphrase['x_mailer']);
Save and upload the file again.
You're done.
Known issues:
none.
Versions:
1.0.0 (initial release). (5. April 2007)
1.1.0 (10. April 2007)
1.1.1 (11. April 2007) fix a bug
1.2.0 (17. May 2007) Very good version, every bug fixed.
1.3.0 (16 June 2008) Version for 3.7.1
Support is given for who clicks "install" only.
Mark it as "Installed" to receive updates and support.