RemoveHeader Method
This method removes custom header from the message.
blnResult = ObjectName.RemoveHeader(HeaderName) |
Parameters: | ||
HeaderName As String | Custom header name (like "X-Priority", "Organization", etc.) | |
Return value As Boolean | True if successful. False if header name is empty, predefined (such as "From", "Date", etc.) or there is no such a header in this message. |
Usage example:
' This sample retrieves first message in the account and in case if "X-Priority" header presents in the message removes it. ' Then, sends modified message back to the server. Dim MailerPOP, MailerSMTP, Msg ' Using visual basic to create object Set MailerPOP = CreateObject("MailBee.POP3") Set MailerSMTP = CreateObject("MailBee.SMTP") ' Using ASP to create object ' Set MailerPOP = Server.CreateObject("MailBee.POP3") ' Set MailerSMTP = Server.CreateObject("MailBee.SMTP") ' In ASP use Response.Write instead of MsgBox MailerPOP.LicenseKey = "put your license key" MailerSMTP.LicenseKey = "put your license key" MailerSMTP.ServerName = "mailserver.com" If MailerPOP.Connect("mailserver.com", 110, "MyName", "MyPassword") Then If MailerPOP.MessageCount > 0 Then Set Msg = MailerPOP.RetrieveSingleMessage(1) If Not Msg Is Nothing Then ' Check if specified header presents in a message If Msg.GetHeader("X-Priority") <> "" Then If Msg.RemoveHeader("X-Priority") Then MsgBox "Header successfully removed" Else MsgBox "Failed to remove header" End If End If Set MailerSMTP.Message = Msg ' Send modified message back to the server If Not MailerSMTP.Send Then MsgBox "Error #" & MailerSMTP.ErrCode & ", " & MailerSMTP.ErrDesc Else MailerSMTP.Disconnect End If End If Else MsgBox "Your mailbox is empty." End If MailerPOP.Disconnect End If
See Also:
AddHeader Method | GetHeader Method | Message Object | POP3 Object | SMTP Object
Copyright © 2002-2024, AfterLogic Corporation. All rights reserved.