RemoveCharsetFromBody Method


Removes the meta tag containing the charset declaration of the document from the HTML body, and returns the charset removed.

This method scans the contents of BodyText property for <meta ... Content="... charset=..."> declaration and removes this tag from the BodyText value, returning the charset removed. This is useful when you convert the charset of the HTML so that the charset setting in the HTML no longer matches the actual charset of the document.


strCharset = ObjectName.RemoveCharsetFromBody  
Parameters: None 
Return value As String The charset of the message as extracted from meta tag.  

Usage example:

Dim Mailer, strCharset
'Using visual basic to create object
Set Mailer = CreateObject("MailBee.SMTP")
'Using ASP to create object
'Set Mailer = Server.CreateObject("MailBee.SMTP")
'In ASP use Response.Write instead of MsgBox
Mailer.LicenseKey = "put your license key here"
Mailer.ServerName = "mail.server.com"
If Mailer.Connect Then
  Mailer.Message.ToAddr = "bill@yoursite.com"
  Mailer.Message.FromAddr = "joe@mysite.com"
  Mailer.Message.Subject = "Hello"
  Mailer.Message.ImportBodyText "C:\docs\e-mail.htm", True
  strCharset = Mailer.Message.RemoveCharsetFromBody
  Mailer.Message.ConvertCharset Mailer.Message.BodyText, strCharset, "UTF-8"
  Mailer.Message.Charset = "UTF-8"
  Mailer.Send
  Mailer.Disconnect
End If

See Also:

Message Object
Charset Property
ConvertCharset Method


Copyright 2002-2011, AfterLogic Corporation. All rights reserved.