C
Curtis Guy
I have a signature stored in Outlook that is automatically inserted when I
create a new email.
I have created a VBScript to generate an email and would like to insert that
same signature, or possibly a different one, into the email. I have
searched in vain for a method of accessing the signatures from a script.
I am currently inserting a "signature" as part of the message text, but want
to make this script available so that anyone can use it and have their
signature inserted.
Can someone help me on this? I have included a sample of the script I have
written.
Thanks.
Sample script follows:
<?xml version="1.0"?>
<?job error="true" debug="true"?>
<!--
Create email
-->
<job>
<reference object="Outlook.Application" />
<script language="VBScript">
<![CDATA[
' Force all variables to be defined
Option Explicit
Dim OlApp, Recip, Message, Attachment, blankLine
Dim sigLine, sigLine01, sigLine02, sigLine03, sigLine04, sigLine05
Dim sigLine06, sigLine07, sigLine08, sigLine09, sigLine10, sigLine11
Dim msgLine01, msgLine02, sig
' Setup blank line
blankLine = " " + vbCrLf
' Setup signature lines
sigLine01 = "Signatrue line 1" + vbCrLf
sigLine02 = "Signature line 2" + vbCrLf
sigLine = sigLine01 & blankLine & sigLine02
' Create the Outlook application object.
Set OlApp = CreateObject("Outlook.Application")
' Create the email
Set Message = OlApp.CreateItem(olMailItem)
Message.Subject = "Test Email"
msgLine01 = "This is a test email with a signature line added." + vbCrLf
Message.Body = msgLine01 & blankLine & blankLine & sigLine
' Add and resolve recipients.
Set Recip = Message.Recipients.Add("(e-mail address removed)")
Message.Save
' Release the message object
Set Message = Nothing
' Quit the script
WScript.Quit
]]>
</script>
</job>
create a new email.
I have created a VBScript to generate an email and would like to insert that
same signature, or possibly a different one, into the email. I have
searched in vain for a method of accessing the signatures from a script.
I am currently inserting a "signature" as part of the message text, but want
to make this script available so that anyone can use it and have their
signature inserted.
Can someone help me on this? I have included a sample of the script I have
written.
Thanks.
Sample script follows:
<?xml version="1.0"?>
<?job error="true" debug="true"?>
<!--
Create email
-->
<job>
<reference object="Outlook.Application" />
<script language="VBScript">
<![CDATA[
' Force all variables to be defined
Option Explicit
Dim OlApp, Recip, Message, Attachment, blankLine
Dim sigLine, sigLine01, sigLine02, sigLine03, sigLine04, sigLine05
Dim sigLine06, sigLine07, sigLine08, sigLine09, sigLine10, sigLine11
Dim msgLine01, msgLine02, sig
' Setup blank line
blankLine = " " + vbCrLf
' Setup signature lines
sigLine01 = "Signatrue line 1" + vbCrLf
sigLine02 = "Signature line 2" + vbCrLf
sigLine = sigLine01 & blankLine & sigLine02
' Create the Outlook application object.
Set OlApp = CreateObject("Outlook.Application")
' Create the email
Set Message = OlApp.CreateItem(olMailItem)
Message.Subject = "Test Email"
msgLine01 = "This is a test email with a signature line added." + vbCrLf
Message.Body = msgLine01 & blankLine & blankLine & sigLine
' Add and resolve recipients.
Set Recip = Message.Recipients.Add("(e-mail address removed)")
Message.Save
' Release the message object
Set Message = Nothing
' Quit the script
WScript.Quit
]]>
</script>
</job>