Adding a footer to all outgoing messages

Rodz
Posts: 3
Joined: Fri Jan 24, 2003 1:06 pm

Adding a footer to all outgoing messages

Postby Rodz » Thu Jun 26, 2003 1:59 am

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

dougie
Posts: 3
Joined: Mon Jun 30, 2003 12:07 am

Re: Adding a footer to all outgoing messages

Postby dougie » Wed Dec 17, 2003 2:16 pm

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


Rod,

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?

MDColson
Posts: 109
Joined: Sat Aug 23, 2003 8:29 pm

Postby MDColson » Wed Dec 17, 2003 2:52 pm

I too would be interested in this... If anyone has the vb scripting abilities and some free time! This would be a really cool feature...

MDColson

sunpost
Posts: 438
Joined: Wed Sep 04, 2002 3:04 pm

Postby sunpost » Wed Dec 17, 2003 11:28 pm

-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

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


good luck :!:

Slicer101
Posts: 95
Joined: Fri Jun 27, 2003 9:26 pm
Location: Houston, TX

Postby Slicer101 » Thu Dec 18, 2003 9:08 pm

Is there a way to make this work ONLY on the outgoing messages? You state that it puts in on everything. I would not want it on INCOMING stuff as that would add something an e-mail from an outside source.

My apologies if I am reading what you posted the wrong way.

Slicer

sunpost
Posts: 438
Joined: Wed Sep 04, 2002 3:04 pm

Postby sunpost » Fri Dec 19, 2003 4:36 am

i was able to get the domain name of the sender...this can be useful for hosts with multiple postoffices and domains.

replace...

Code: Select all

TextBodyFooter = vbNewLine & "your footer"
HTMLBodyFooter = "<BR>your footer" & vbNewLine

with

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
just add a new case for each domain that you want a disclaimer. i did not do much testing.

good luck :!:

quba
Posts: 29
Joined: Thu Jul 01, 2004 8:05 pm
Location: Germany

Re: Adding a footer to all outgoing messages

Postby quba » Fri Nov 20, 2015 1:32 pm

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

Who is online

Users browsing this forum: No registered users and 6 guests