USING STANDARD VERSION
I would like to use the MTA to add a company disclaimer message to all outgoing e-mail. Can anyone help me with this? Perhaps with a VBS script.
Thanks
Rodz
Adding a footer to all outgoing messages
Re: Adding a footer to all outgoing messages
Rod,Rodz wrote:USING STANDARD VERSION
I would like to use the MTA to add a company disclaimer message to all outgoing e-mail. Can anyone help me with this? Perhaps with a VBS script.
Thanks
Rodz
Did you ever get an answer to this question?
I would like to be able to do the same thing, it apears that an MTA pick up event has to be created with a script that allows the "Appending" of the footer message to the email before it is transmitted through SMTP.
Has anyone done this?
-i did not stress test this....it is a good start
-replace TextBodyFooter & HTMLBodyFooter with your message
-it puts the footer on anything that passes thru the MTA.
-for installation--search for mtape
good luck
-replace TextBodyFooter & HTMLBodyFooter with your message
-it puts the footer on anything that passes thru the MTA.
-for installation--search for mtape
Code: Select all
Option Explicit
Dim MyMessage
Dim WshShell
Dim MailDataPath
Dim MessageID
Dim ConnectorCode
Dim MessageFilePath
Dim TextBodyFooter
Dim HTMLBodyFooter
Dim InsertPosition
Set WshShell = CreateObject("WScript.Shell")
MailDataPath = WshShell.RegRead("HKLM\SOFTWARE\Mail Enable\Mail Enable\Data Directory")
MessageID = wscript.arguments(0)
ConnectorCode = wscript.arguments(1)
MessageFilePath = MailDataPath & "\Queues\" & ConnectorCode & "\Inbound\Messages\" & MessageID
Set MyMessage = LoadMessageFromFile(MessageFilePath)
TextBodyFooter = vbNewLine & "your footer"
HTMLBodyFooter = "<BR>your footer" & vbNewLine
MyMessage.TextBody = MyMessage.TextBody & TextBodyFooter
If MyMessage.HTMLBody <> "" Then
InsertPosition = GetInsertPosition(MyMessage.HTMLBody)
MyMessage.HTMLBody = Left(MyMessage.HTMLBody, InsertPosition) & HTMLBodyFooter & Right(MyMessage.HTMLBody, Len(MyMessage.HTMLBody) - InsertPosition)
End If
SaveMessageToFile MyMessage, MessageFilePath
'********************************************************************************************************************
Function LoadMessageFromFile(Path) 'As Message
Dim Stm
Dim iMsg
Dim iDsrc
Set Stm = CreateObject("ADODB.Stream")
Stm.Charset = "ascii"
Stm.Open
Stm.LoadFromFile Path
Set iMsg = CreateObject("CDO.Message")
Set iDsrc = iMsg.GetInterface("IDataSource")
iDsrc.OpenObject Stm, "_Stream"
Set LoadMessageFromFile = iMsg
End Function
'********************************************************************************************************************
Sub SaveMessageToFile(iMsg, Filepath)
Dim Stm
Dim iDsrc
Set Stm = CreateObject("ADODB.Stream")
Stm.Open
Stm.Type = 2 'adTypeText
Stm.Charset = "US-ASCII"
Set iDsrc = iMsg.DataSource
iDsrc.SaveToObject Stm, "_Stream"
Stm.SaveToFile Filepath, 2 'adSaveCreateOverWrite
End Sub
'********************************************************************************************************************
Function GetInsertPosition(MyMessageHTMLBody)
GetInsertPosition = Instr(1, MyMessageHTMLBody, "</body>", 1) - 1
End Function
i was able to get the domain name of the sender...this can be useful for hosts with multiple postoffices and domains.
replace...
with
just add a new case for each domain that you want a disclaimer. i did not do much testing.
good luck
replace...
Code: Select all
TextBodyFooter = vbNewLine & "your footer"
HTMLBodyFooter = "<BR>your footer" & vbNewLine
Code: Select all
Select Case Replace(Right(MyMessage.From, Len(MyMessage.From) - InStrRev(MyMessage.From, "@")), ">", "")
Case "yourdomainnamegoeshere"
TextBodyFooter = vbNewLine & "your footer"
HTMLBodyFooter = "<BR>your footer" & vbNewLine
Case Else
TextBodyFooter = ""
HTMLBodyFooter = ""
End Select
good luck
Re: Adding a footer to all outgoing messages
Hi,
I know this thread is very very old but I found this solution to implement footer/signature to outgouing mails.
But I have found one scenario in a few tests which did not work:
If using MEWebmail the script crashes because the webmail does not create a correct html mail.
The <body> tags on which the script checks does not exist in a html-message from MEWebmail.
Has anyone a workaround for it or another solution to get footer/signature for outgoing mails work?
Thanks and best regards,
quba
I know this thread is very very old but I found this solution to implement footer/signature to outgouing mails.
But I have found one scenario in a few tests which did not work:
If using MEWebmail the script crashes because the webmail does not create a correct html mail.
The <body> tags on which the script checks does not exist in a html-message from MEWebmail.
Has anyone a workaround for it or another solution to get footer/signature for outgoing mails work?
Thanks and best regards,
quba